otel-cli icon indicating copy to clipboard operation
otel-cli copied to clipboard

add version subcommand and code + linker flags to embed version info

Open tobert opened this issue 4 years ago • 0 comments

When a user has a problem, it is useful to know what version they're trying. Today, if all they have is a binary, it's difficult to impossible to tell. Since otel-cli is intended to get buried in build systems, Docker containers, OS installers, and the like, it's probably going to be important for operators of these systems to be able to tell what version is installed.

goreleaser can set ldflags to version, commit, and date in the go binary, so that it can report this information to users

Seen in another repo:

    ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}}

and then in main.go

var (
	// Populated by goreleaser during build
	version = "master"
	commit  = "?"
	date    = ""
)

tobert avatar Aug 18 '21 22:08 tobert