-
Notifications
You must be signed in to change notification settings - Fork 33
Description
When using this library to build a CLI tool, any call to --version (either through go run . or by running go build and then on the built binary) returns the default 'no VCS information' message.
Looking at the output of debug.ReadBuildInfo, I can see that the Version field is populated but it is missing any value in the Sum field so this line fails.
Line 197 in 055c2e3
| if info, ok := debug.ReadBuildInfo(); ok && info.Main.Sum != "" { |
From testing, it appears the only way to set this field is to go install the binary. This could be difficult if the VCS repository is private or the code requires some amount of generation before being built.
This limitation seems like it should be documented somewhere. It also seems like there should be a way to just say 'trust the VCS information in the binary'.