dominikbraun / timetrace

A simple CLI for tracking your working time.
Apache License 2.0
668 stars 75 forks source link

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

Closed RedemptionC closed 2 years ago

RedemptionC commented 2 years ago

https://github.com/dominikbraun/timetrace/blob/564a621b8a0d942652b39125964f7945bd4df83a/main.go#L13

dominikbraun commented 2 years ago

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:

https://github.com/dominikbraun/timetrace/blob/564a621b8a0d942652b39125964f7945bd4df83a/.circleci/config.yml#L76-L78

↑ 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 commented 2 years ago

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:

https://github.com/dominikbraun/timetrace/blob/564a621b8a0d942652b39125964f7945bd4df83a/.circleci/config.yml#L76-L78

↑ 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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

RedemptionC commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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