X Tutup
Skip to content

Commit 6c08cd6

Browse files
committed
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
1 parent 89adc83 commit 6c08cd6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ ifndef CGO_LDFLAGS
1919
export CGO_LDFLAGS := $(LDFLAGS)
2020
endif
2121

22-
GO_LDFLAGS := -X github.com/cli/cli/command.Version=$(GH_VERSION)
23-
GO_LDFLAGS += -X github.com/cli/cli/command.BuildDate=$(BUILD_DATE)
22+
GO_LDFLAGS := -X github.com/cli/cli/command.Version=$(GH_VERSION) $(GO_LDFLAGS)
23+
GO_LDFLAGS := -X github.com/cli/cli/command.BuildDate=$(BUILD_DATE) $(GO_LDFLAGS)
2424
ifdef GH_OAUTH_CLIENT_SECRET
25-
GO_LDFLAGS += -X github.com/cli/cli/internal/config.oauthClientID=$(GH_OAUTH_CLIENT_ID)
26-
GO_LDFLAGS += -X github.com/cli/cli/internal/config.oauthClientSecret=$(GH_OAUTH_CLIENT_SECRET)
25+
GO_LDFLAGS := -X github.com/cli/cli/internal/config.oauthClientID=$(GH_OAUTH_CLIENT_ID) $(GO_LDFLAGS)
26+
GO_LDFLAGS := -X github.com/cli/cli/internal/config.oauthClientSecret=$(GH_OAUTH_CLIENT_SECRET) $(GO_LDFLAGS)
2727
endif
2828

2929
bin/gh: $(BUILD_FILES)

0 commit comments

Comments
 (0)
X Tutup