From 6c08cd696f7b979fd67ec5beabb73c6547741b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Fri, 17 Jul 2020 13:43:42 +0200 Subject: [PATCH] Enable adding to GO_LDFLAGS without having to replace them all To produce a slimmer binary, this is now supported: GO_LDFLAGS="-s -w" GH_VERSION="vX.Y.Z" make --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 504564dee..0bffa784d 100644 --- a/Makefile +++ b/Makefile @@ -19,11 +19,11 @@ ifndef CGO_LDFLAGS export CGO_LDFLAGS := $(LDFLAGS) endif -GO_LDFLAGS := -X github.com/cli/cli/command.Version=$(GH_VERSION) -GO_LDFLAGS += -X github.com/cli/cli/command.BuildDate=$(BUILD_DATE) +GO_LDFLAGS := -X github.com/cli/cli/command.Version=$(GH_VERSION) $(GO_LDFLAGS) +GO_LDFLAGS := -X github.com/cli/cli/command.BuildDate=$(BUILD_DATE) $(GO_LDFLAGS) ifdef GH_OAUTH_CLIENT_SECRET - GO_LDFLAGS += -X github.com/cli/cli/internal/config.oauthClientID=$(GH_OAUTH_CLIENT_ID) - GO_LDFLAGS += -X github.com/cli/cli/internal/config.oauthClientSecret=$(GH_OAUTH_CLIENT_SECRET) + GO_LDFLAGS := -X github.com/cli/cli/internal/config.oauthClientID=$(GH_OAUTH_CLIENT_ID) $(GO_LDFLAGS) + GO_LDFLAGS := -X github.com/cli/cli/internal/config.oauthClientSecret=$(GH_OAUTH_CLIENT_SECRET) $(GO_LDFLAGS) endif bin/gh: $(BUILD_FILES)