Repository navigation
ci: adopt centralized component workflows #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,16 +84,23 @@ deps: | |
| $(GOMOD) download | ||
| $(GOMOD) tidy | ||
|
|
||
| ## Run linter (requires golangci-lint) | ||
| lint: | ||
| golangci-lint run ./... | ||
| # CI supplies this environment variable from the reusable workflow. | ||
| GOLANGCILINT_VERSION ?= v2.14.0 | ||
| GOLANGCI_LINT = $(CURDIR)/bin/golangci-lint-$(GOLANGCILINT_VERSION) | ||
|
|
||
| ## Install golangci-lint if not present | ||
| install-lint: | ||
| @which golangci-lint > /dev/null || (echo "Installing golangci-lint..." && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest) | ||
| ## Run linter | ||
| lint: install-lint | ||
| $(GOLANGCI_LINT) run ./... | ||
|
|
||
| ## Install the selected golangci-lint version locally | ||
| install-lint: $(GOLANGCI_LINT) | ||
| $(GOLANGCI_LINT): | ||
| mkdir -p $(CURDIR)/bin | ||
| GOBIN=$(CURDIR)/bin go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCILINT_VERSION) | ||
| mv $(CURDIR)/bin/golangci-lint $(GOLANGCI_LINT) | ||
|
Comment on lines
+97
to
+100
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
|
|
||
| ## Run linter with installation check | ||
| lint-check: install-lint lint | ||
| lint-check: lint | ||
|
|
||
| ## Build Docker image | ||
| docker-build: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the checkout path contains spaces, the shell splits the unquoted
$(CURDIR)inmkdir,GOBIN, andmv. The linter cannot be installed or run from that checkout. Quote the generated paths throughout the installer and lint command.