Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix var name for commit hash used for version subcommand #1150

Merged
merged 1 commit into from
Sep 28, 2024

Conversation

rinx
Copy link
Contributor

@rinx rinx commented Sep 28, 2024

I found that regal version subcommand does not show commit hash.

❯ ./regal version             
Version:    0.27.0
Go Version: go1.22.5
Platform:   linux/amd64
Commit:     unknown
Timestamp:  2024-09-17T15:00:44Z
Hostname:   github.actions.local

This is because the build time information is passed to pkg/version.Commit variable, but it does not exist there.

- -X github.com/styrainc/regal/pkg/version.Commit={{ .Commit }}

I fixed this problem by renaming pkg/version.Vcs to pkg/version.Commit.

❯ go build -ldflags='-X github.com/styrainc/regal/pkg/version.Commit=my-commit'

❯ ./regal version
Version:    unknown
Go Version: go1.22.7
Platform:   linux/amd64
Commit:     my-commit
Timestamp:  unknown
Hostname:   unknown

that used for `version` subcommand

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>
Copy link
Member

@srenatus srenatus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@anderseknert anderseknert merged commit 3cba1c6 into StyraInc:main Sep 28, 2024
4 checks passed
srenatus pushed a commit to srenatus/regal that referenced this pull request Oct 1, 2024
that used for `version` subcommand

Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants