Skip to content

Commit

Permalink
🌱 Download golangci-lint instead of building it
Browse files Browse the repository at this point in the history
To reduce our go.mod/go.sum in our hack/tools folder, and to always make
sure to sync golangci-lint version between our GitHub Action and our
Makefile, this changeset introduces a way to download golangci-lint
using their published download script.

For now, we opted to copy the download script to avoid downloading it
over the wire and then executing it.

Signed-off-by: Vince Prignano <vincepri@vmware.com>
  • Loading branch information
vincepri committed May 28, 2021
1 parent 58cdbed commit cca009e
Show file tree
Hide file tree
Showing 5 changed files with 436 additions and 491 deletions.
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@ clusterctl: ## Build clusterctl binary
$(CONTROLLER_GEN): $(TOOLS_DIR)/go.mod # Build controller-gen from tools folder.
cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/controller-gen sigs.k8s.io/controller-tools/cmd/controller-gen

$(GOLANGCI_LINT): $(TOOLS_DIR)/go.mod # Build golangci-lint from tools folder.
cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint

$(GOTESTSUM): $(TOOLS_DIR)/go.mod # Build gotestsum from tools folder.
cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/gotestsum gotest.tools/gotestsum

Expand All @@ -196,9 +193,14 @@ $(GO_APIDIFF): $(TOOLS_DIR)/go.mod
$(ENVSUBST): $(TOOLS_DIR)/go.mod
cd $(TOOLS_DIR) && go build -tags=tools -o $(ENVSUBST_BIN) github.com/drone/envsubst/v2/cmd/envsubst

$(KUSTOMIZE): # Build kustomize from tools folder.
$(KUSTOMIZE): # Download kustomize using hack script into tools folder.
hack/ensure-kustomize.sh

$(GOLANGCI_LINT): .github/workflows/golangci-lint.yml # Download golanci-lint using hack script into tools folder.
hack/ensure-golangci-lint.sh \
-b $(TOOLS_DIR)/$(BIN_DIR) \
$(shell cat .github/workflows/golangci-lint.yml | grep version | sed 's/.*version: //')

envsubst: $(ENVSUBST) ## Build a local copy of envsubst.
kustomize: $(KUSTOMIZE) ## Build a local copy of kustomize.
controller-gen: $(CONTROLLER_GEN) ## Build a local copy of controller-gen.
Expand Down
Loading

0 comments on commit cca009e

Please sign in to comment.