Include build date in -version output
This commit is contained in:
parent
6364c4ff3f
commit
f76fe1ac7a
5
build.sh
5
build.sh
@ -4,6 +4,7 @@ export COPYFILE_DISABLE=true
|
|||||||
|
|
||||||
distFiles=(README.md LICENSE) # apart from the binary itself
|
distFiles=(README.md LICENSE) # apart from the binary itself
|
||||||
version=$(git describe --always --dirty)
|
version=$(git describe --always --dirty)
|
||||||
|
date=$(date +%s)
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
if command -v godep >/dev/null ; then
|
if command -v godep >/dev/null ; then
|
||||||
@ -14,8 +15,8 @@ build() {
|
|||||||
go get -d ./cmd/syncthing
|
go get -d ./cmd/syncthing
|
||||||
godep=
|
godep=
|
||||||
fi
|
fi
|
||||||
${godep} go build $* -ldflags "-w -X main.Version $version" ./cmd/syncthing
|
${godep} go build $* -ldflags "-w -X main.Version $version -X main.BuildStamp $date" ./cmd/syncthing
|
||||||
${godep} go build -ldflags "-w -X main.Version $version" ./cmd/stcli
|
${godep} go build -ldflags "-w -X main.Version $version -X main.BuildStamp $date" ./cmd/stcli
|
||||||
}
|
}
|
||||||
|
|
||||||
assets() {
|
assets() {
|
||||||
|
|||||||
@ -28,10 +28,19 @@ import (
|
|||||||
|
|
||||||
const BlockSize = 128 * 1024
|
const BlockSize = 128 * 1024
|
||||||
|
|
||||||
var cfg Configuration
|
var (
|
||||||
var Version = "unknown-dev"
|
Version = "unknown-dev"
|
||||||
|
BuildStamp = "0"
|
||||||
|
BuildDate time.Time
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
stamp, _ := strconv.Atoi(BuildStamp)
|
||||||
|
BuildDate = time.Unix(int64(stamp), 0)
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
cfg Configuration
|
||||||
myID string
|
myID string
|
||||||
confDir string
|
confDir string
|
||||||
rateBucket *ratelimit.Bucket
|
rateBucket *ratelimit.Bucket
|
||||||
@ -80,7 +89,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if showVersion {
|
if showVersion {
|
||||||
fmt.Printf("syncthing %s (%s %s-%s)\n", Version, runtime.Version(), runtime.GOOS, runtime.GOARCH)
|
date := BuildDate.UTC().Format(time.RFC3339)
|
||||||
|
fmt.Printf("syncthing %s (%s %s-%s) %s\n", Version, runtime.Version(), runtime.GOOS, runtime.GOARCH, date)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user