I know there are several ways of accomplishing this with just a little extra code, but it got me curious... Is there a way to set an unassigned integer in a Go application using ldflags? For instance, could you call...
go build -ldflags "-X main.CurrentEnvironment 1"
And have it set:
package main
var CurrentEnvironment int
func main() {
...
}
I couldn't find any documentation supporting this so I presume the answer is no but maybe there's a way.