Skip to content

Commit

Permalink
Fix setting binary version during build
Browse files Browse the repository at this point in the history
Signed-off-by: Kimmo Lehto <[email protected]>
  • Loading branch information
kke committed Oct 10, 2023
1 parent 0597f8a commit 709d491
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ BIN_PREFIX := bootloose-
all: bootloose

bootloose:
go build -v $(BUILD_FLAGS) -o bootloose .
go build -v $(BUILD_FLAGS) -o bootloose main.go

PLATFORMS := linux-amd64 linux-arm64 linux-arm darwin-amd64 darwin-arm64
bins := $(foreach platform, $(PLATFORMS), bin/$(BIN_PREFIX)$(platform))
Expand All @@ -27,10 +27,10 @@ $(bins):
$(eval temp := $(subst -, ,$(subst $(BIN_PREFIX),,$(notdir $@))))
$(eval OS := $(word 1, $(subst -, ,$(temp))))
$(eval ARCH := $(word 2, $(subst -, ,$(temp))))
GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=0 go build $(BUILD_FLAGS) -o $@ .
GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=0 go build $(BUILD_FLAGS) -o $@ main.go

bin/%: $(GO_SRCS)
GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=$(CGO_ENABLED) go build $(BUILD_FLAGS) -o $@ .
GOOS=$(OS) GOARCH=$(ARCH) CGO_ENABLED=$(CGO_ENABLED) go build $(BUILD_FLAGS) -o $@ main.go

bin/sha256sums.txt: $(bins)
sha256sum -b $(bins) | sed 's|bin/||' > $@
Expand Down
1 change: 0 additions & 1 deletion cmd/bootloose/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package bootloose
import (
"fmt"

_ "github.com/carlmjohnson/versioninfo" // Needed to set version info during go install
"github.com/k0sproject/bootloose/version"

"github.com/spf13/cobra"
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (

"github.com/k0sproject/bootloose/cmd/bootloose"

_ "github.com/carlmjohnson/versioninfo" // Ensure version info is added to binary

log "github.com/sirupsen/logrus"
)

Expand Down

0 comments on commit 709d491

Please sign in to comment.