Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upgpython: Display build information and support some builtin attribute #44
Comments
|
Looks like we can inject the commit log by using ldflag during build time. |
|
This is slightly awkward to do as it can't be done using the standard I do this in rclone and I have a Makefile which does the build https://github.com/ncw/rclone/blob/39eac7a7658494a5404dfd75c80f0be3e6d222b2/Makefile#L35 If you build rclone not via the Makefile you get a I'm pretty sure you can do this with go-releaser which we use to build the release binaries. I had a chat with the debian maintainer about rclone and this issue, and his thoughts were that the program should build using the normal go tools to make the correct version number at the releases. Which kind of implies when we make a release, we should check in the build description. That is what I do in rclone anyway, but the Makefile adds a git ID for non release builds. |
|
not sure there's anything else than what if we wanted to also support Windows, we could perhaps use |
|
Probably the simplest thing is to go with what goreleaser provides us with: So make a version.go file with this in package main
var (
version = "dev"
commit = "none"
date = "unknown"
)Then the release builds will have the correct version, commit and date in. The dev builds will have "dev" "none" and "unknown".
This provides most of what we need here. Note that we should show the go runtime version os and arch too as that is really important debugging info.
|
|
@ncw LGTM |
|
Looks like a good first issue for a newbie of this project.
|


Likewise, PyPy3, if we can display build information such as commit information, go version.
it will be awesome.
Also, we need to implement
copyright,creditsandlicenseas a built-in attribute.