-
-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the need to inject Version manually #768
base: master
Are you sure you want to change the base?
Conversation
Use debug.ReadBuildInfo() to generate Version. Before: $ CGO_ENABLED=0 go install ./cmd/goatcounter $ goatcounter version version=dev; go=go1.23.1; GOOS=linux; GOARCH=amd64; race=false; cgo=false After: $ CGO_ENABLED=0 go install ./cmd/goatcounter $ goatcounter version version=535cf676f9a3_2024-09-23T18:24:51Z; go=go1.23.1; GOOS=linux; GOARCH=amd64; race=false; cgo=false After, with a locally modified file: $ CGO_ENABLED=0 go install ./cmd/goatcounter $ goatcounter version version=8ab2fe057181_2024-09-23T18:49:30Z-dev; go=go1.23.1; GOOS=linux; GOARCH=amd64; race=false; cgo=false Technically this variable should live inside cmd/goatcounter but that would be a more significant refactoring.
Yeah, all of this was written before that was added to Go. zli.GetVersion() actually does a lot of this. We can't use it for getting the tag name (I don't want people's existing |
I personally find the dirty check useful, to know if I had a local uncommitted modification. It doesn't hurt. |
Is there a race condition in TestDBUser where the query isn't flushed yet? |
Use debug.ReadBuildInfo() to generate Version.
Before:
After:
After, with a locally modified file:
Technically this variable should live inside cmd/goatcounter but that would be a more significant refactoring.