diff options
author | Gabriel Russell <gabriel.russell@mongodb.com> | 2016-03-04 19:12:12 -0500 |
---|---|---|
committer | Gabriel Russell <gabriel.russell@mongodb.com> | 2016-03-17 17:00:38 -0400 |
commit | db308a698f3adf3ac18c03242d94dfd8f5e42b0f (patch) | |
tree | e4d6fb29f2ba107ed4cf7b142be0023cae794f0b | |
parent | 51c0f04747d150a7a1250b39d00ae983ffd1119c (diff) | |
download | mongo-db308a698f3adf3ac18c03242d94dfd8f5e42b0f.tar.gz |
TOOLS-1098 make VersionStr overridable
-rwxr-xr-x | build.sh | 2 | ||||
-rw-r--r-- | common.yml | 2 | ||||
-rw-r--r-- | common/options/options.go | 7 |
3 files changed, 4 insertions, 7 deletions
@@ -19,5 +19,5 @@ mkdir -p bin for i in bsondump mongostat mongofiles mongoexport mongoimport mongorestore mongodump mongotop mongooplog; do echo "Building ${i}..." # Build the tool, using -ldflags to link in the current gitspec - go build -o "bin/$i" -ldflags "-X github.com/mongodb/mongo-tools/common/options.Gitspec `git rev-parse HEAD`" -tags "$tags" "$i/main/$i.go" + go build -o "bin/$i" -ldflags "-X github.com/mongodb/mongo-tools/common/options.Gitspec `git rev-parse HEAD` -X github.com/mongodb/mongo-tools/common/options.VersionStr $(git describe)" -tags "$tags" "$i/main/$i.go" done diff --git a/common.yml b/common.yml index c4e8f2cd720..7ef2ee4f66a 100644 --- a/common.yml +++ b/common.yml @@ -240,7 +240,7 @@ functions: export ${library_path} fi . ./set_gopath.sh - go build ${args} ${build_tags} -o bin/${tool} ${tool}/main/${tool}.go + go build -ldflags "-X github.com/mongodb/mongo-tools/common/options.Gitspec `git rev-parse HEAD` -X github.com/mongodb/mongo-tools/common/options.VersionStr $(git describe)" ${args} ${build_tags} -o bin/${tool} ${tool}/main/${tool}.go "download mongod": command: shell.exec diff --git a/common/options/options.go b/common/options/options.go index 026d376e17b..df2dcc2381c 100644 --- a/common/options/options.go +++ b/common/options/options.go @@ -13,13 +13,10 @@ import ( "strings" ) -const ( - VersionStr = "3.2.5-pre-" -) - // Gitspec that the tool was built with. Needs to be set using -ldflags var ( - Gitspec = "not-built-with-ldflags" + VersionStr = "not-built-with-ldflags" + Gitspec = "not-built-with-ldflags" ) // Struct encompassing all of the options that are reused across tools: "help", |