diff --git a/Makefile b/Makefile index 9e92de04e58e2..4e73f8c362ebd 100644 --- a/Makefile +++ b/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/ diff --git a/scripts/build.py b/scripts/build.py index d391ec2e122de..3fa171c5a016f 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -470,26 +470,11 @@ 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, - get_current_branch(), - get_current_commit()) + build_command += "-ldflags=\"-w -s -X main.version={} -X main.branch={} -X main.commit={}\" ".format( + version, + get_current_branch(), + get_current_commit()) if static: build_command += "-a -installsuffix cgo " build_command += path