...
1#!/bin/sh
2
3# This bash script outputs the current, desired content of version.go, using
4# git describe. For best effect, pipe this to the target file. Generally, this
5# only needs to updated for releases. The actual value of will be replaced
6# during build time if the makefile is used.
7
8set -e
9
10cat <<EOF
11package version
12
13// Package is the overall, canonical project import path under which the
14// package was built.
15var Package = "$(go list)"
16
17// Version indicates which version of the binary is running. This is set to
18// the latest release tag by hand, always suffixed by "+unknown". During
19// build, it will be replaced by the actual version. The value here will be
20// used if the registry is run after a go install based install.
21var Version = "$(git describe --match 'v[0-9]*' --dirty='.m' --always)+unknown"
22
23// Revision is filled with the VCS (e.g. git) revision being used to build
24// the program at linking time.
25var Revision = ""
26EOF
View as plain text