14 lines
319 B
Bash
14 lines
319 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
set -euo pipefail
|
||
|
IFS=$'\n\t'
|
||
|
|
||
|
gitchanges="false"
|
||
|
if [[ `git status --porcelain` ]]; then
|
||
|
gitchanges="true"
|
||
|
fi
|
||
|
gitsha1=$(git rev-parse HEAD | head -c 9)
|
||
|
buildtime=$(date --iso-8601=seconds)
|
||
|
|
||
|
go build -ldflags "-X main.gitchanges=$gitchanges -X main.gitSHA1=$gitsha1 -X main.buildTime=$buildtime"
|