Skip to content

Commit

Permalink
switch the golangci install method
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Sch <[email protected]>
  • Loading branch information
SchSeba committed May 21, 2024
1 parent fc002af commit 644f1f1
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ GOLANGCI_LINT = $(GOBIN)/golangci-lint
# we keep it fixed to avoid it from unexpectedly failing on the project
# in case of a version bump
GOLANGCI_LINT_VER = v1.51.2
export GOLANGCI_LINT_CACHE = /tmp/.cache

TIMEOUT = 15
Q = $(if $(filter 1,$V),,@)

Expand All @@ -68,8 +70,8 @@ $(BUILDDIR)/$(BINARY_NAME): $(GOFILES) | $(BUILDDIR)
@cd $(BASE)/cmd/$(PACKAGE) && CGO_ENABLED=0 $(GO) build -o $(BUILDDIR)/$(BINARY_NAME) -tags no_openssl -ldflags $(LDFLAGS) -v

# Tools
$(GOLANGCI_LINT): ; $(info installing golangci-lint...)
$Q go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VER)
$(GOLANGCI_LINT): ; $(info installing golangci-lint...)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VER))


# Tests
Expand Down Expand Up @@ -171,3 +173,12 @@ rm -r $(1)/shellcheck*/;\
rm $(1)/shellcheck.tar.xz;\
}
endef

# go-install-tool will 'go install' any package $2 and install it to $1.
define go-install-tool
@[ -f $(1) ] || { \
set -e ;\
echo "Downloading $(2)" ;\
GOBIN=$(BINDIR) go install -mod=mod $(2) ;\
}
endef

0 comments on commit 644f1f1

Please sign in to comment.