Closed kevinmichaelchen closed 1 year ago
Hi @kevinmichaelchen ,
I'm unsure about the issue you're flagging. Can you expand?
cw
is built using ldflags
.
The current version reported from my installation is 4.1.3; that is the latest one.
Hey @lucagrulla --
I'm seeing the latest release as v4.1.3, but in the code I'm seeing 4.1.1 hard-coded.
The code value is a placeholder, but the actual version is injected at build time with ldflags
.
I appreciate it might be confusing.
I will set the variable to ''
.
What is the name of the ldflag that overrides the version?
I couldn't find anything in this repo.
Ah, sorry, -X main.version
was what I was looking for.
Thanks for bearing with me. I'm still learning ldflags
.
I'm not sure I understand your question.
ldflags
can be passed at linking time to go build
:
go build -ldflags="-X main.version=x.y.z"
where x.y.z
is the version you want to inject
cw
uses goreleaser
to create all the packages. goreleaser will inject the current git tag in the version variable.
https://goreleaser.com/cookbooks/using-main.version/
I'm building a Tea package for this project here: https://github.com/teaxyz/pantry/pull/3085
Currently,
cw --version
reports an old version.