Skip to content

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

@tobert

Description

@tobert

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    = ""
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions