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

why is the output of version command "UNDEFINED"? #169

Closed
RedemptionC opened this issue Aug 3, 2021 · 8 comments
Closed

why is the output of version command "UNDEFINED"? #169

RedemptionC opened this issue Aug 3, 2021 · 8 comments
Labels
question Further information is requested

Comments

@RedemptionC
Copy link
Contributor

var version = "UNDEFINED"

@dominikbraun dominikbraun added the question Further information is requested label Aug 3, 2021
@dominikbraun
Copy link
Owner

Hi,

the source code itself does not know what version it is. Instead, the version number is injected when building the timetrace binary on a new release:

GOOS=linux GOARCH=amd64 go build \
-v \
-ldflags "-X main.version=${CIRCLE_TAG}" \

↑ This overwrites the version variable with the version stored in the $CIRCLE_TAG environment variable.

As a result, when running the version command from source, the output will be UNDEFINED - but when running the version command from a released binary, the actual version will be displayed.

Does this answer your question?

@RedemptionC
Copy link
Contributor Author

Hi,

the source code itself does not know what version it is. Instead, the version number is injected when building the timetrace binary on a new release:

GOOS=linux GOARCH=amd64 go build \
-v \
-ldflags "-X main.version=${CIRCLE_TAG}" \

↑ This overwrites the version variable with the version stored in the $CIRCLE_TAG environment variable.

As a result, when running the version command from source, the output will be UNDEFINED - but when running the version command from a released binary, the actual version will be displayed.

Does this answer your question?

I installed timetrace using

sudo snap install timetrace --edge --devmode

and then I run timetrace version,it says:💡 timetrace version UNDEFINED
is this behavior reasonable?
or should I use other method to install,so that it can print proper version?

@dominikbraun
Copy link
Owner

Ah, I see. This is probably because the version information is not yet available in the Snap configuration. Snap directly builds timetrace from source.

Gonna create an issue for this :-)

@RedemptionC
Copy link
Contributor Author

Ah, I see. This is probably because the version information is not yet available in the Snap configuration. Snap directly builds timetrace from source.

Gonna create an issue for this :-)

got it
thanks for your quick reply
But it seems there are no realease directly available to ubuntu 20.04 LTS user,say,using apt?

@dominikbraun
Copy link
Owner

Yes, there are no apt releases yet. In that case, you'd have to directly download the binary or run it in Docker.

@RedemptionC
Copy link
Contributor Author

Yes, there are no apt releases yet. In that case, you'd have to directly download the binary or run it in Docker.

a binary is good for me
Thanks again :)

@dominikbraun
Copy link
Owner

I've created #171 for making timetrace available via apt in the future. 😄 Going to close this issue in turn, feel free to re-open it for further questions on this matter.

@RedemptionC
Copy link
Contributor Author

I've created #171 for making timetrace available via apt in the future. Going to close this issue in turn, feel free to re-open it for further questions on this matter.

sure
love this project and I want to make some contribution to it
but currently I probably will focus on some golang-related issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants