Build releases with -w -s ldflags
This commit is contained in:
parent
6efd5a0b67
commit
07cda8903a
2
Makefile
2
Makefile
|
@ -26,7 +26,7 @@ telegraf:
|
|||
go build -o $(TELEGRAF) -ldflags "$(LDFLAGS)" ./cmd/telegraf/telegraf.go
|
||||
|
||||
go-install:
|
||||
go install -ldflags "$(LDFLAGS)" ./cmd/telegraf
|
||||
go install -ldflags "-w -s $(LDFLAGS)" ./cmd/telegraf
|
||||
|
||||
install: telegraf
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin/
|
||||
|
|
|
@ -470,24 +470,9 @@ def build(version=None,
|
|||
build_command += "-race "
|
||||
if len(tags) > 0:
|
||||
build_command += "-tags {} ".format(','.join(tags))
|
||||
if "1.4" in get_go_version():
|
||||
if static:
|
||||
build_command += "-ldflags=\"-s -X main.version {} -X main.branch {} -X main.commit {}\" ".format(version,
|
||||
get_current_branch(),
|
||||
get_current_commit())
|
||||
else:
|
||||
build_command += "-ldflags=\"-X main.version {} -X main.branch {} -X main.commit {}\" ".format(version,
|
||||
get_current_branch(),
|
||||
get_current_commit())
|
||||
|
||||
else:
|
||||
# Starting with Go 1.5, the linker flag arguments changed to 'name=value' from 'name value'
|
||||
if static:
|
||||
build_command += "-ldflags=\"-s -X main.version={} -X main.branch={} -X main.commit={}\" ".format(version,
|
||||
get_current_branch(),
|
||||
get_current_commit())
|
||||
else:
|
||||
build_command += "-ldflags=\"-X main.version={} -X main.branch={} -X main.commit={}\" ".format(version,
|
||||
build_command += "-ldflags=\"-w -s -X main.version={} -X main.branch={} -X main.commit={}\" ".format(
|
||||
version,
|
||||
get_current_branch(),
|
||||
get_current_commit())
|
||||
if static:
|
||||
|
|
Loading…
Reference in New Issue