Skip to content

Commit 180e433

Browse files
committed
Remove revision variable, '-ldflags -X' injection
* Most users would do 'go get' instead of 'make' * 'revision' value is always "Devel" when built by 'make' Thus 'revision' variable is meaningless, remove it.
1 parent a411a09 commit 180e433

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11

22
NAME := volt
33
SRC := $(wildcard *.go */*.go)
4-
VERSION := $(shell bin/volt version | sed -E 's/^volt version: (\S+).*/\1/')
5-
DEVEL_LDFLAGS := -X github.com/vim-volt/go-volt/cmd.revision=$(git rev-parse --short HEAD)
6-
RELEASE_LDFLAGS := $(DEVEL_LDFLAGS) -extldflags '-static'
4+
VERSION := $(shell sed -n -E 's/var version string = "([^"]+)"/\1/p' cmd/version.go)
5+
RELEASE_LDFLAGS := -extldflags '-static'
76
RELEASE_OS := linux windows darwin
87
RELEASE_ARCH := amd64 386
98

@@ -13,7 +12,7 @@ BIN_DIR := bin
1312
all: $(BIN_DIR)/$(NAME)
1413

1514
$(BIN_DIR)/$(NAME): $(SRC)
16-
go build -ldflags "$(DEVEL_LDFLAGS)" -o $(BIN_DIR)/$(NAME)
15+
go build -o $(BIN_DIR)/$(NAME)
1716

1817
setup:
1918
@which go >/dev/null 2>&1 || (echo '[Error] You need to install go,make commands'; exit 1)

cmd/version.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ package cmd
33
import "fmt"
44

55
var version string = "v0.0.3"
6-
var revision string = "Devel"
76

87
func Version(args []string) int {
9-
fmt.Printf("volt version: %s (rev %s)\n", version, revision)
8+
fmt.Printf("volt version: %s\n", version)
109

1110
return 0
1211
}

0 commit comments

Comments
 (0)