Skip to content

Commit

Permalink
feat(build): add make lint target
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Feb 11, 2025
1 parent b1376cf commit b9873cf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ jobs:
- uses: ./.github/actions/install-system-dependencies
- uses: ./.github/actions/install-go
- uses: ./.github/actions/make-deps
- run: go install github.com/golangci/golangci-lint/cmd/[email protected]
- run: golangci-lint run -v --timeout 10m --concurrency 4
- run: make lint
check-fmt:
name: Check (gofmt)
runs-on: ubuntu-latest
Expand Down
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ $(warning Your Golang version is go$(shell expr $(GOVERSION) / 1000000).$(shell
$(error Update Golang to version to at least $(shell cat GO_VERSION_MIN))
endif

GOLANGCI_LINT_VERSION=v1.59.0

# git modules that need to be loaded
MODULES:=

Expand Down Expand Up @@ -283,6 +285,20 @@ unittests: ## Run unit tests
@$(GOCC) test $(shell go list ./... | grep -v /lotus/itests)
.PHONY: unittests

install-linter:
@if ! command -v golangci-lint >/dev/null 2>&1; then \
echo "Installing golangci-lint $(GOLANGCI_LINT_VERSION)" && \
go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION); \
elif ! golangci-lint --version | grep -q "$(GOLANGCI_LINT_VERSION) "; then \
echo "Updating golangci-lint to $(GOLANGCI_LINT_VERSION)" && \
go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION); \
fi
.PHONY: install-linter

lint: install-linter
golangci-lint run --timeout 10m --concurrency 4
.PHONY: lint

clean: ## Clean build artifacts
rm -rf $(CLEAN) $(BINS)
-$(MAKE) -C $(FFI_PATH) clean
Expand Down

0 comments on commit b9873cf

Please sign in to comment.