Skip to content

Commit e8097a1

Browse files
authored
Merge pull request #2410 from mohamedawnallah/fallback-to-GOPATH-bin-dir
Makefile+workflows: fallback to `GOPATH/bin` on non-existent `GOBIN`
2 parents a4ddae2 + 29f4215 commit e8097a1

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ env:
55
# go needs absolute directories, using the $HOME variable doesn't work here.
66
GOCACHE: /home/runner/work/go/pkg/build
77
GOPATH: /home/runner/work/go
8+
GOBIN: /home/runner/work/go/bin
89
GO_VERSION: 1.22.11
910

1011
jobs:

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ LINT_PKG := github.com/golangci/golangci-lint/v2/cmd/golangci-lint
44
GOIMPORTS_PKG := golang.org/x/tools/cmd/goimports
55

66
GO_BIN := ${shell go env GOBIN}
7+
8+
# If GOBIN is not set, default to GOPATH/bin.
9+
ifeq ($(GO_BIN),)
10+
GO_BIN := $(shell go env GOPATH)/bin
11+
endif
12+
713
LINT_BIN := $(GO_BIN)/golangci-lint
814
GOIMPORTS_BIN := $(GO_BIN)/goimports
915

@@ -73,7 +79,7 @@ install:
7379
$(GOINSTALL) $(PKG)/cmd/findcheckpoint
7480
$(GOINSTALL) $(PKG)/cmd/addblock
7581

76-
#? release-install: Install btcd and btcctl release binaries, place them in $GOPATH/bin
82+
#? release-install: Install btcd and btcctl release binaries, place them in $GOBIN
7783
release-install:
7884
@$(call print, "Installing btcd and btcctl release binaries")
7985
env CGO_ENABLED=0 $(GOINSTALL) -trimpath -ldflags="-s -w -buildid=" $(PKG)

0 commit comments

Comments
 (0)