Version flag
smhmd opened this issue · comments
$ hostctl -v || hostctl --version
hostctl 0.10.0
or add it to the output of the help
command?
implemented on v0.10.2. 👍
UPDATE: there is a bug on Arch linux builds that is not using $VERSION to build and always report version dev
.
$ hostctl -v
hostctl version dev
dev
as a version is not helpful, because it'll be dev
all the time, it seems. (this was true of 0.10.1
and is true now of 0.10.2
.)
It should be filled by the build workflow, that's a bug. I'll check it.
UPDATE: @smhmd How did you get dev
as version? I've just downloaded the binary for v0.10.2
and reports the version just fine. Are you building from source?
@guumaster Yes, I'm using the AUR: yay -S hostctl
. If you wanna supply a hostctl-bin
package, too, I would use it. Less carbon footprint.
@BarbUk do you know how to pass -ldflags
parameter to PKGBUILD
so the build script add the proper version to the binary?
the pkgbuild is already building with -ldflags:
build() {
cd $pkgname-$pkgver
go build \
-trimpath \
-ldflags "-extldflags $LDFLAGS" \
-o $pkgname .
}
How do you pass the version to go build
?
-X github.com/guumaster/hostctl/cmd.version=$pkgver
Made the change in the pkgbuild.
❯ hostctl -v
hostctl version 1.0.2
hostctl -v
still outputs hostctl version dev
on my end (installed through the AUR).
highlighted line illustrates that I have a feature only available on 1.0.8
https://github.com/guumaster/hostctl/releases/tag/v1.0.8
Ldflags need to be updated following 007b415.
The update is available in https://aur.archlinux.org/cgit/aur.git/commit/?h=hostctl&id=42f1eed07bba06554ffb4f73a3ea9871771ba920
I did not update pkgrel
to not break the package release automation.
@smhmd, you can reinstall the package or wait for the next release.
@guumaster, your new commit break the version passed via ldflags.
I fixed the goreleaser yml and also just updated the PKGBUILD file, can you confirm it works on Arch?
yes:
$ hostctl -v
hostctl version 1.0.9