@@ -51,12 +51,51 @@ VAL_URL := https://github.com/errata-ai/vale/releases/download/v$(VALE_VERSION)/
51
51
sed 's,darwin,macOS,g'| sed 's,linux,Linux,g'| sed 's,windows,Windows,g') _$(shell echo $(HOST_ARCH ) | sed 's,amd64,64-bit,g')$(shell echo $(HOST_OS ) | \
52
52
sed 's,darwin,.tar.gz,g'| sed 's,linux,.tar.gz,g'| sed 's,windows,.zip,g')
53
53
54
- ifeq ($(CI ) ,true)
55
- GOBIN := $(subst /,\,$(ROOT_DIR ) /hack/tools/$(BIN_DIR ) )
54
+
55
+ ifeq ($(GITHUB_ACTIONS ) ,true)
56
+ # Use the values from GitHub Actions
57
+ GOPATH := $(shell echo $$GOPATH)
58
+ GOBIN := $(shell echo $$GOBIN)
59
+ GITHUB_INFO := Running in GitHub Actions
56
60
else
57
- GOBIN := $(ROOT_DIR ) /hack/tools/$(BIN_DIR )
61
+ # Use the system's GOPATH and GOBIN; if they're not set, use defaults
62
+ GOPATH ?= $(HOME ) /go
63
+ GOBIN ?= $(GOPATH ) /bin
64
+ GITHUB_INFO := Not running in GitHub Actions
58
65
endif
59
66
67
+ $(info GOPATH before update : $(GOPATH ) )
68
+ $(info GOBIN before update : $(GOBIN ) )
69
+ $(info $(GITHUB_INFO))
70
+
71
+ # Normalize $(ROOT_DIR) and ensure no double slashes before appending
72
+ GOBIN := $(patsubst % /,% ,$(subst \,/,${ROOT_DIR}) ) /hack/tools/$(BIN_DIR )
73
+
74
+ # Ensure $(GOPATH) uses forward slashes
75
+ GOPATH := $(subst \,/,$(GOPATH ) )
76
+
77
+
78
+ # It's best to use these echo commands in an actual recipe, not directly in the conditional logic
79
+ # For demonstration purposes, they are kept here but consider moving them into a rule's command
80
+ $(info GOBIN after update : $(GOBIN ) )
81
+ $(info GOPATH after update : $(GOPATH ) )
82
+
83
+
84
+ golangci-lint : $(GOLANGCI_LINT ) # # Install golangci-lint
85
+ $(GOLANGCI_LINT ) :
86
+ @echo " GOPATH current: $( GOPATH) "
87
+ @echo " GOBIN current: $( GOBIN) "
88
+ mkdir -p $(BIN_DIR )
89
+ @ls $(GOPATH )
90
+ @ls $(GOPATH ) /bin
91
+ go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$(GOLANGCI_LINT_VERSION )
92
+ @ls $(GOPATH )
93
+ @ls $(GOPATH ) /bin
94
+ @echo " GOBIN files: $( GOBIN) "
95
+ @ls $(GOBIN )
96
+ # mv $(GOPATH)/$(GOLANGCI_LINT) $(GOBIN) && chmod a+x $(GOBIN)/$(notdir $(GOLANGCI_LINT))
97
+
98
+
60
99
# # --------------------------------------
61
100
# # Help
62
101
# # --------------------------------------
@@ -70,11 +109,11 @@ help: ## Display this help
70
109
71
110
goimports : $(GOIMPORTS ) # # Install goimports
72
111
$(GOIMPORTS ) :
73
- @echo " BIN_DIR : $( BIN_DIR ) "
74
- @echo " ROOT_DIR: $( ROOT_DIR ) "
75
- @echo " GOBIN path: $( ROOT_DIR ) /hack /tools/$( BIN_DIR ) "
76
- @mkdir -p $( BIN_DIR )
77
- @GOBIN= $( subst \,/, $( ROOT_DIR ) /hack/tools/ $( BIN_DIR ) ) go install golang.org/x/tools/cmd/goimports@v $( GOIMPORTS_VERSION )
112
+ @echo " gobin in goimports : $( GOBIN ) "
113
+ mkdir -p $(BIN_DIR )
114
+ go install golang.org/x /tools/cmd/goimports@v $( GOIMPORTS_VERSION )
115
+ @echo " GOBIN files: $( GOBIN ) "
116
+ @ls $( GOBIN )
78
117
79
118
# mkdir -p $(BIN_DIR)
80
119
# GOBIN=$(ROOT_DIR)/hack/tools/$(BIN_DIR) go install golang.org/x/tools/cmd/goimports@v$(GOIMPORTS_VERSION)
@@ -84,13 +123,6 @@ $(GOIMPORTS):
84
123
# mv $(GOPATH)/bin/goimports $(GOIMPORTS)
85
124
# GOBIN=$(ROOT_DIR)/hack/tools/$(BIN_DIR) go install golang.org/x/tools/cmd/goimports@v$(GOIMPORTS_VERSION)
86
125
87
- golangci-lint : $(GOLANGCI_LINT ) # # Install golangci-lint
88
- $(GOLANGCI_LINT ) :
89
- @echo " Installing golangci-lint to $( GOLANGCI_LINT) "
90
- @echo " GOBIN path: $( ROOT_DIR) /hack/tools/$( BIN_DIR) "
91
- @echo " GOBIN will be set to $( GOBIN) "
92
- mkdir -p $(BIN_DIR )
93
- GOBIN=$(ROOT_DIR ) /hack/tools/$(BIN_DIR ) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$(GOLANGCI_LINT_VERSION )
94
126
95
127
vale : $(VALE )
96
128
$(VALE ) :
@@ -112,18 +144,17 @@ $(VALE):
112
144
controller-gen : $(CONTROLLER_GEN ) # # Build controller-gen
113
145
$(CONTROLLER_GEN ) :
114
146
mkdir -p $(BIN_DIR )
115
- # go build -tags=tools -o $@ sigs.k8s.io/controller-tools/cmd/controller-gen
116
- GOBIN=$(ROOT_DIR ) /hack/tools/$(BIN_DIR ) go install sigs.k8s.io/controller-tools/cmd/controller-gen@v$(CONTROLLER_TOOLS_VERSION )
147
+ go install sigs.k8s.io/controller-tools/cmd/controller-gen@v$(CONTROLLER_TOOLS_VERSION )
117
148
118
149
cosign : $(COSIGN ) # # Install cosign
119
150
$(COSIGN ) :
120
151
mkdir -p $(BIN_DIR )
121
- GOBIN= $( ROOT_DIR ) /hack/tools/ $( BIN_DIR ) go install github.com/sigstore/cosign/v2/cmd/cosign@v$(COSIGN_VERSION )
152
+ go install github.com/sigstore/cosign/v2/cmd/cosign@v$(COSIGN_VERSION )
122
153
123
154
misspell : $(MISSPELL ) # # Install misspell
124
155
$(MISSPELL ) :
125
156
mkdir -p $(BIN_DIR )
126
- GOBIN= $( ROOT_DIR ) /hack/tools/ $( BIN_DIR ) go install github.com/client9/misspell/cmd/misspell@v$(MISSPELL_VERSION )
157
+ go install github.com/client9/misspell/cmd/misspell@v$(MISSPELL_VERSION )
127
158
128
159
imgpkg : $(IMGPKG ) # # Install imgpkg
129
160
$(IMGPKG ) :
@@ -152,12 +183,13 @@ $(KIND):
152
183
ginkgo : $(GINKGO ) # # Install ginkgo
153
184
$(GINKGO ) :
154
185
mkdir -p $(BIN_DIR )
155
- GOBIN= $( ROOT_DIR ) /hack/tools/ $( BIN_DIR ) go install github.com/onsi/ginkgo/v2/ginkgo@$(GINKGO_VERSION )
186
+ go install github.com/onsi/ginkgo/v2/ginkgo@$(GINKGO_VERSION )
156
187
157
188
go-junit-report : $(GOJUNITREPORT ) # # Install go-junit-report
158
189
$(GOJUNITREPORT ) :
159
190
mkdir -p $(BIN_DIR )
160
- GOBIN=$(ROOT_DIR ) /hack/tools/$(BIN_DIR ) go install github.com/jstemmer/go-junit-report@latest
191
+ go install github.com/jstemmer/go-junit-report@latest
192
+ @ls $(GOBIN )
161
193
162
194
# # --------------------------------------
163
195
# # Cleanup
0 commit comments