Conversation
mreiferson
left a comment
There was a problem hiding this comment.
Great start, thanks for opening the PR @zunayed! ❤️
|
|
||
| commit := $(shell git rev-parse --short HEAD) | ||
| version := $(shell go version) | ||
| ldflags := '-X "main.goVersion=$(version)"' |
There was a problem hiding this comment.
Go has a runtime.Version() func in the standard library that we can use instead of passing a variable externally into the build process.
| func main() { | ||
| if len(os.Args) > 1 && os.Args[1] == "version" { | ||
| fmt.Println(auth.VERSION) | ||
| fmt.Println(goVersion) |
There was a problem hiding this comment.
Aesthetic and nit-picky, but my preference for this would be:
sso-{proxy,auth} vX.XX (built w/goX.XX)
There was a problem hiding this comment.
I'd just like to reiterate my request in #36 (comment) that the app version and go version be split across two lines for easier tooling.
In my (fairly limited) experience, the thing that matters when building automation is the app version, and it's a bit annoying to have to do extra work to split it out from the go version.
There was a problem hiding this comment.
Ahh, sorry I missed that in the original issue.
I get it, and can probably get over my distaste. I feel like you would still have to parse it, e.g. by grabbing just the first line of output, but yea, that is easier.
| } | ||
|
|
||
| func main() { | ||
| if len(os.Args) > 1 && os.Args[1] == "version" { |
There was a problem hiding this comment.
I'd like to see this as an actual command line flag (i.e. sso-auth --version), rather than a manually-parsed argument. Primarily, my thinking is that it if we implement it that way, it'll automatically show up in sso-auth --help output, so users will know it's an option.
mreiferson
left a comment
There was a problem hiding this comment.
Great start, thanks for opening the PR @zunayed! ❤️
pr for #36
Solution
Using
LDFLAGSfor the go version and looking up the version variable or the binary version