From 36aa7b3eecc074da81e0d4c0fd80b649edb97426 Mon Sep 17 00:00:00 2001 From: Sourabh Mehta Date: Wed, 13 Nov 2024 12:59:19 +0100 Subject: [PATCH] Fix: Version number in released binaries --- .github/workflows/build.yml | 4 ++++ cmd/cli.go | 2 +- cmd/version.go | 4 ++-- makefile | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 61f3f90..b5f2bde 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,10 +14,14 @@ jobs: steps: - name: Check out repository code uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install go 1.22 uses: actions/setup-go@v5 with: go-version: ${{ matrix.go }} + - name: Build run: | make build/vidx2pidx diff --git a/cmd/cli.go b/cmd/cli.go index e169eb4..732ae9c 100644 --- a/cmd/cli.go +++ b/cmd/cli.go @@ -25,7 +25,7 @@ var flags struct { // printVersionAndLicense prints out vidx2pidx current version and its license. func printVersionAndLicense(file io.Writer) { - fmt.Fprintf(file, "vidx2pidx version %v %v\n", Version, License) + fmt.Fprintf(file, "vidx2pidx version %v %v\n", version, License) } // NewCli creates a new instance of vidx2pidx cli. diff --git a/cmd/version.go b/cmd/version.go index ac0f7f5..e2a6e3b 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -3,9 +3,9 @@ package main -// Version contains the version of vidx2pid. +// version contains the version of vidx2pid. // Its value is collected in build time. See `make build/vidx2pidx`. -var Version string +var version string // License is a hardcoded string specifying vidx2pidx's license. const License = `Copyright 2021 Linaro diff --git a/makefile b/makefile index 7288ef2..27e9642 100644 --- a/makefile +++ b/makefile @@ -44,7 +44,7 @@ all: $(PROG): $(SOURCES) @echo Building project - GOOS=$(OS) GOARCH=$(ARCH) go build -ldflags "-X main.Version=`git describe 2>/dev/null || echo unknown`" -o $(PROG) ./... + GOOS=$(OS) GOARCH=$(ARCH) go build -ldflags "-X main.version=`git describe 2>/dev/null || echo unknown`" -o $(PROG) ./... run: $(PROG) @./$(PROG) $(ARGS) || true