3 ms·
This is one area that the Go ecosystem leaves me wanting a bit more. Idiomatic Go says that my package should be go-gettable, which AFAIK just uses `go install`
by andrewstuart2 11y ago
This is one area that the Go ecosystem leaves me wanting a bit more. Idiomatic Go says that my package should be go-gettable, which AFAIK just uses `go install` command after fetching dependencies.
Is there an idiomatic way to include build options/tasks, while remaining go-gettable?
- zalmoxes 11y agoYou can use ldflags with go get go get -u -ldflags "-X main.Version foo" github.com/influxdb/telegraf/cmd/telegraf
- ominous_prime 11y agoThis doesn't affect `go get`. You can use the same options when fetching the package, setting the variable or leaving it as the default. go get -ldflags="-X main.Who CloudFlare" import/path/package
- andrewstuart2 11y agoI guess that's pretty reasonable. Especially coupled with sensible defaults for your variables like "unreleased" in the article. If you're building for a release you're probably a lot more up-to-speed on the needs for a release build anyway.