File: README.md

package info (click to toggle)
golang-github-hlandau-buildinfo 0.0~git20160722.0.b25d4b0-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 96 kB
  • sloc: sh: 3; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 1,473 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Go build information utilities

These are some small build information utilities I wrote for tracking Go binary
version information. Rather than trying to assign a linear version number to a
binary, the tag names and version control commit hashes of all dependencies are
tracked. This information is then burnt into the binary at build time.

You use the shell script `gen`, included, to generate the version information
blob. It outputs arguments suitable for `go build`, so you can use it like `go
build ./... -ldflags "$($GOPATH/src/github.com/hlandau/buildinfo/gen ./...)"`.

## For upstream packagers

OS upstream packagers which want to specify their own information may do so:
simply set the `github.com/hlandau/buildinfo.RawBuildInfo` string variable at
build time, by passing `-ldflags -X
github.com/hlandau/buildinfo.RawBuildInfo=BUILDINFO...` to `go build`. This
expects base64-encoded data in a particular format.

If you want to specify an arbitrary freeform string instead, set `BuildInfo`
instead of `RawBuildInfo`. The string you specify will be used verbatim without
modification.

Example:

```
go install -ldflags '-X github.com/hlandau/buildinfo.BuildInfo="Packaged by Distro X"' \
  github.com/my/project 
```

### Previous location

This package was previously located at
`github.com/hlandau/degoutils/buildinfo`. Packagers setting
`github.com/hlandau/degoutils/buildinfo.BuildInfo` will need to change to
`github.com/hlandau/buildinfo.BuildInfo`.