To compile my golang package so that it produces a statically linked executable, I must say:
go install -tags netgo
Additionally I now realise that on a system without gcc, I must:
go get -tags netgo github.com/mypackage/...
go test -tags netgo ./...
If you're typing this all the time it's no so nice. I have aliases set up so I can type less, but is there a "nicer" or "proper" way to set -tags netgo as some kind of default? Ideally as part of my package itself, so a stranger trying to work with my package doesn't miss the -tags netgo.
Edit: I also want the possibility to say:
go install -tags netgo -ldflags '-linkmode external -extldflags -static -w'
Ie. link to C code that can be statically compiled. So it working on a machine without GCC is less important to me than it producing a statically linked executable. I just wonder if there's a way to do the latter without saying -tags netgo all the time.