mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-31 22:11:51 +00:00
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
|
||||
version=$(git describe --always --dirty)
|
||||
date=$(date +%s)
|
||||
|
||||
build() {
|
||||
if command -v godep >/dev/null ; then
|
||||
@ -14,8 +15,8 @@ build() {
|
||||
go get -d ./cmd/syncthing
|
||||
godep=
|
||||
fi
|
||||
${godep} go build $* -ldflags "-w -X main.Version $version" ./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/syncthing
|
||||
${godep} go build -ldflags "-w -X main.Version $version -X main.BuildStamp $date" ./cmd/stcli
|
||||
}
|
||||
|
||||
assets() {
|
||||
|
@ -28,10 +28,19 @@ import (
|
||||
|
||||
const BlockSize = 128 * 1024
|
||||
|
||||
var cfg Configuration
|
||||
var Version = "unknown-dev"
|
||||
var (
|
||||
Version = "unknown-dev"
|
||||
BuildStamp = "0"
|
||||
BuildDate time.Time
|
||||
)
|
||||
|
||||
func init() {
|
||||
stamp, _ := strconv.Atoi(BuildStamp)
|
||||
BuildDate = time.Unix(int64(stamp), 0)
|
||||
}
|
||||
|
||||
var (
|
||||
cfg Configuration
|
||||
myID string
|
||||
confDir string
|
||||
rateBucket *ratelimit.Bucket
|
||||
@ -80,7 +89,8 @@ func main() {
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user