Nah, I wish it were it that easy. There is definitely more yak shaving involved.
"go mod init" returns the error "go: cannot determine module path for source directory".
"go mod init src/mything/mypackage" creates a go.mod file, but then "env GOPATH=$PWD go build mything/mypackage" says "$GOPATH/go.mod exists but should not" (as opposed to when it isn't there, then go complains "go.mod file not found in current directory")
Note that "env GOPATH=$PWD GO111MODULE=off go build mything/mypackage" does build all the source code.
Most likely I've set the whole project and directory structure up wrong, and it only works by brute force.
it should have been `go mod init mything/mypackage` (without the `src/`) in the `GOPATH/src/mything/mypackage` directory,
and `GOPATH=$PWD` is almost certainly wrong. The `go` command in module mode assumes independence from GOPATH, so to build something, you have to be "in" the module (under a directory with a `go.mod` file).
1. Go mod init in your code’s root dir 2. Done..? Go get ./…?