Skip to content

Commit

Permalink
Revert "Export variable"
Browse files Browse the repository at this point in the history
This reverts commit a3c507a.
  • Loading branch information
dandavison committed Aug 19, 2024
1 parent a3c507a commit 508c25a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ This will expect every non-parent command to have a `run` method, so for new com
## Inject additional build-time information
To add build-time information to the version string printed by the binary, use

go build -ldflags "-X github.com/temporalio/cli/temporalcli.BuildInfo=<MyString>"
go build -ldflags "-X github.com/temporalio/cli/temporalcli.buildInfo=<MyString>"

This can be useful if, for example, you've used a `replace` statement in go.mod pointing to a local directory.
Note that inclusion of space characters in the value supplied via `-ldflags` is tricky.
Here's an example that adds branch info from a local repo to the version string, and includes a space character:

go build -ldflags "-X 'github.com/temporalio/cli/temporalcli.BuildInfo=ServerBranch $(cd ../temporal && git rev-parse --abbrev-ref HEAD)'" -o temporal ./cmd/temporal/main.go
go build -ldflags "-X 'github.com/temporalio/cli/temporalcli.buildInfo=ServerBranch $(cd ../temporal && git rev-parse --abbrev-ref HEAD)'" -o temporal ./cmd/temporal/main.go
6 changes: 3 additions & 3 deletions temporalcli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,12 @@ func (c *TemporalCommand) initCommand(cctx *CommandContext) {
}
}

var BuildInfo string
var buildInfo string

func VersionString() string {
// To add build-time information to the version string, use
// go build -ldflags "-X github.com/temporalio/cli/temporalcli.BuildInfo=<MyString>"
var bi = BuildInfo
// go build -ldflags "-X github.com/temporalio/cli/temporalcli.buildInfo=<MyString>"
var bi = buildInfo
if bi != "" {
bi = fmt.Sprintf(", %s", bi)
}
Expand Down

0 comments on commit 508c25a

Please sign in to comment.