# Get the version. githash=`git rev-parse --short HEAD` branch=`git rev-parse --abbrev-ref HEAD` buildstamp=`date -u '+%Y-%m-%d_%H:%M:%S'` commits=`git rev-list --count $branch` # Write out the package. cat << EOF > version.go // Code generated by version.sh (@generated) DO NOT EDIT. package main var githash = "$githash" var branch = "$branch" var buildstamp = "$buildstamp" var commits = "$commits" var version = "$githash-b$commits - $buildstamp" EOF