Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #15 from onmetal/fix/version_parsing
Browse files Browse the repository at this point in the history
Use main.version as the version variable
  • Loading branch information
guvenc authored Oct 4, 2023
2 parents ad20907 + 99fe0e0 commit a178725
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test: fmt vet ## Run tests.

.PHONY: build
build: fmt vet ## Build binary.
go build -ldflags "-X 'github.com/onmetal/dpservice-cli/util.BuildVersion=${shell git describe --tags}'" -o bin/dpservice-cli main.go
go build -ldflags "-X 'main.version=${shell git describe --tags}'" -o bin/dpservice-cli main.go

.PHONY: install
install:
Expand Down
4 changes: 4 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ import (
"strings"

"github.com/onmetal/dpservice-cli/cmd"
"github.com/onmetal/dpservice-cli/util"
"github.com/onmetal/net-dpservice-go/errors"
)

var version = "unknown"

func main() {
util.BuildVersion = version
if err := cmd.Command().Execute(); err != nil {
if strings.Contains(err.Error(), "Unimplemented desc") {
fmt.Println("Error in gRPC, client and server are probably using different proto version")
Expand Down

0 comments on commit a178725

Please sign in to comment.