Open maruel opened 1 month ago
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 -X zgo.at/goatcounter/v2.Version=
to break), but it can be used for getting the commit hash. It doesn't return the vcs.modified, but the if dirty { Version += "-dev" }
isn't that important IMHO.
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?
I double checked the github workflow and it doesn't use the testpg
build flag that would enable testing with postgres.
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.