-
Notifications
You must be signed in to change notification settings - Fork 39
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
cmd: Add 'version' option #220
base: main
Are you sure you want to change the base?
Conversation
CI fails because of #218 |
cmd/fakemachine/main.go
Outdated
@@ -11,6 +11,8 @@ import ( | |||
"strings" | |||
) | |||
|
|||
const Version = "0.0.10" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoding is somewhat likely to break unfortunately; I wonder if golang has some good ways to generate the version from e.g. git or a package release? Would also be good to include the git version if it's not a specific release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Untested but pretty sure we can inject the version at build time with go build -ldflags "-X main.Version=$VERSION"
.
How do you feel about
- injecting the version in the GitHub action based on git commit
- injecting the same version in the Debian packaging
I looked for existing libraries to do this, like in rust, but couldn't find anything.
(Also the same will be true for debos)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that what's typical in the go space (surely others do this as well)? But yeah in principle that sounds fine, my main concern is really that it's too easy to forget to update :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, the version is injected at build time based on git describe --tags HEAD
. Is that better?
1412fa6
to
019ca7f
Compare
This 'version' option prints the fakemachine version Signed-off-by: Dylan Aïssi <[email protected]>
Signed-off-by: Dylan Aïssi <[email protected]>
019ca7f
to
2f17226
Compare
This 'version' option prints the fakemachine version. Fix #200