Actually writing the code was fun at first, but everything else around the actual act of composing code was thoroughly awful UX.
Actually writing the code was fun at first, but everything else around the actual act of composing code was thoroughly awful UX.
Just use go get to get initially, and go mod to organize thereafter. It is very simple and occupies <1% of my cognitive effort writing go code.
Imho, many languages would massively benefit with the kind of tooling Go has out of the box. I heard Rust's tooling has some great stuff too and it's in my immediate plan to learn some Rust.
I forget the solution, but involved messing about with the `GOPRIVATE` env variable, adding some `.insteadOf` entries to git config, plus similar fun trying to get the same happening in a CI environment.
Now this gives an error "go.mod file not found in current directory", but if I add that file, go build says "unexpected go.mod file found in current directory".
Luckily, for now, I can use GO111MODULE=off to keep pretending everything is fine, but my eyes start to glaze over when I read the migration guide at https://go.dev/blog/migrating-to-go-modules - it's one of those moments where I start to wish I'd used a different language :(
1. Go mod init in your code’s root dir 2. Done..? Go get ./…?
"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.