I have a simple application, one single main.go
file. Previously, I would simply run go build
and get a binary with the name of the directory, which is great. After updating to Go 1.16 release, which came out today, I now get this message:
go: cannot find main module, but found .git/config in /home/rjzak/go/src/myproj
to create a module there, run:
cd .. && go mod init
I’m not using modules with this project (it’s not a project really, just a set of simple tools that I converted from Python to Go, since it’s easier to manage, in my opinion). And GO111MODULE=on
is not set, which I checked since Issue 31997 has a similar issue with that being a proposed fix. I also didn’t see anything about changes which would affect my usage of go build
in the release notes.
Thoughts? Am I not doing things the “Go way”? If not, I’m happy to learn that the ideal mechanism is for small applications.