On Wed, Nov 25, 2020 at 6:25 PM changkun <h...@changkun.de> wrote: > As far as I know, there are two approaches to add extra information at build > time: > 1. using -ldflags="-X path/pkg.Var=${ENV_VAR}", in a Makefile > 2. using `go generate ./...`, before `go build` > > These approaches are good as it is if I build my binary and distribute it to > other users. > However, none of these are possible if a user uses `go get > github.com/user/pkg/cmd/x-cli`, because: > 1. `go get` does not understand Makefile > 2. `go generate` does not execute with `go build` automatically. > > What should I do in order to plug the extra information (in my case, the git > version) if my user uses "go get"?
I don't think that can be done. Also IINM, in module mode `go get` no longer uses git. It just downloads the zipped version of the appropriate tag via http from the hosting service. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAA40n-WHoKJG8TeGwTd%3DPnt0VUhK%3D-V1J6sab_aQFNybVyP%3DRQ%40mail.gmail.com.