• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

README.mdH A D12-Nov-20161.4 KiB

buildinfo.goH A D12-Nov-20161.2 KiB

cgo-no.goH A D12-Nov-201653

cgo-yes.goH A D12-Nov-201651

genH A D12-Nov-2016788

query.goH A D12-Nov-20161.3 KiB

README.md

1# Go build information utilities
2
3These are some small build information utilities I wrote for tracking Go binary
4version information. Rather than trying to assign a linear version number to a
5binary, the tag names and version control commit hashes of all dependencies are
6tracked. This information is then burnt into the binary at build time.
7
8You use the shell script `gen`, included, to generate the version information
9blob. It outputs arguments suitable for `go build`, so you can use it like `go
10build ./... -ldflags "$($GOPATH/src/github.com/hlandau/buildinfo/gen ./...)"`.
11
12## For upstream packagers
13
14OS upstream packagers which want to specify their own information may do so:
15simply set the `github.com/hlandau/buildinfo.RawBuildInfo` string variable at
16build time, by passing `-ldflags -X
17github.com/hlandau/buildinfo.RawBuildInfo=BUILDINFO...` to `go build`. This
18expects base64-encoded data in a particular format.
19
20If you want to specify an arbitrary freeform string instead, set `BuildInfo`
21instead of `RawBuildInfo`. The string you specify will be used verbatim without
22modification.
23
24Example:
25
26```
27go install -ldflags '-X github.com/hlandau/buildinfo.BuildInfo="Packaged by Distro X"' \
28  github.com/my/project
29```
30
31### Previous location
32
33This package was previously located at
34`github.com/hlandau/degoutils/buildinfo`. Packagers setting
35`github.com/hlandau/degoutils/buildinfo.BuildInfo` will need to change to
36`github.com/hlandau/buildinfo.BuildInfo`.
37
38