Use automatic extension naming when running go build

This commit is contained in:
Daniel Nelson 2018-04-04 19:00:28 -07:00
parent 23dd19a85f
commit 990343604a
2 changed files with 2 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/build /build
/telegraf /telegraf
/telegraf.exe
/telegraf.gz /telegraf.gz

View File

@ -12,8 +12,6 @@ else
PATH := $(subst :,/bin:,$(GOPATH))/bin:$(PATH) PATH := $(subst :,/bin:,$(GOPATH))/bin:$(PATH)
endif endif
TELEGRAF := telegraf$(shell go tool dist env | grep -q 'GOOS=.windows.' && echo .exe)
LDFLAGS := $(LDFLAGS) -X main.commit=$(COMMIT) -X main.branch=$(BRANCH) LDFLAGS := $(LDFLAGS) -X main.commit=$(COMMIT) -X main.branch=$(BRANCH)
ifdef VERSION ifdef VERSION
LDFLAGS += -X main.version=$(VERSION) LDFLAGS += -X main.version=$(VERSION)
@ -29,7 +27,7 @@ deps:
gdm restore gdm restore
telegraf: telegraf:
go build -i -o $(TELEGRAF) -ldflags "$(LDFLAGS)" ./cmd/telegraf/telegraf.go go build -i -ldflags "$(LDFLAGS)" ./cmd/telegraf
go-install: go-install:
go install -ldflags "-w -s $(LDFLAGS)" ./cmd/telegraf go install -ldflags "-w -s $(LDFLAGS)" ./cmd/telegraf