go mod init [module-path]
Example:
go mod init go mod init example.com/m
This is (almost, can be considered) like an npm init. it initializes and writes a new go.mod file in the current directory
npm init
go.mod