Permalink
Browse files

Print dependency info in version info

Signed-off-by: Patrick Uiterwijk <patrick@puiterwijk.org>
  • Loading branch information...
puiterwijk committed Feb 3, 2019
1 parent c2384dc commit d4ec07717e8121a87f4b4c4ee8169b5b04244cac
Showing with 10 additions and 4 deletions.
  1. +7 −3 build.sh
  2. +3 −1 server/constants/versioninfo.go
@@ -12,25 +12,29 @@ fi

export VERSION="`cat VERSION`"
export GITDESCRIP="`git describe --long --tags --dirty --always`"
export VENDORDESCRIP="`find vendor -type f | xargs cat | sha1sum | tr -d '\n' | sed -e 's/ -//'`"

(
cd cmd/repospanner/
go build -ldflags \
"-X repospanner.org/repospanner/server/constants.version=$VERSION
-X repospanner.org/repospanner/server/constants.gitdescrip=$GITDESCRIP" \
-X repospanner.org/repospanner/server/constants.gitdescrip=$GITDESCRIP
-X repospanner.org/repospanner/server/constants.vendordescrip=$VENDORDESCRIP" \
-o ../../repospanner $@
)
(
cd cmd/repobridge/
go build -ldflags \
"-X repospanner.org/repospanner/server/constants.version=$VERSION
-X repospanner.org/repospanner/server/constants.gitdescrip=$GITDESCRIP" \
-X repospanner.org/repospanner/server/constants.gitdescrip=$GITDESCRIP
-X repospanner.org/repospanner/server/constants.vendordescrip=$VENDORDESCRIP" \
-o ../../repobridge $@
)
(
cd cmd/repohookrunner/
go build -ldflags \
"-X repospanner.org/repospanner/server/constants.version=$VERSION
-X repospanner.org/repospanner/server/constants.gitdescrip=$GITDESCRIP" \
-X repospanner.org/repospanner/server/constants.gitdescrip=$GITDESCRIP
-X repospanner.org/repospanner/server/constants.vendordescrip=$VENDORDESCRIP" \
-o ../../repohookrunner $@
)
@@ -8,6 +8,7 @@ import (
// These strings will be filled in by build.sh
var version string
var gitdescrip string
var vendordescrip string

func VersionBuiltIn() bool {
return version != "" && gitdescrip != ""
@@ -26,8 +27,9 @@ func VersionString() string {
suffix = " WITH PROFILING"
}

return fmt.Sprintf("%s running on %s/%s (compiled with %s)%s",
return fmt.Sprintf("%s (deps %s) running on %s/%s (compiled with %s)%s",
PublicVersionString(),
vendordescrip,
runtime.GOOS,
runtime.GOARCH,
runtime.Version(),

0 comments on commit d4ec077

Please sign in to comment.