Skip to content

Commit

Permalink
make linter auto-installable (for CI)
Browse files Browse the repository at this point in the history
  • Loading branch information
amberpixels committed Nov 16, 2024
1 parent 69225ee commit eccd2ba
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,16 @@ tidy:
@go fmt $$(go list ./...)
@go vet $$(go list ./...)

# Install golangci-lint only if it's not already installed
lint-install:
@if ! [ -x "$(GOLANGCI_LINT)" ]; then \
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest; \
fi

lint:
$(GOLANGCI_LINT) run
# Lint the code using golangci-lint
# todo reuse var if possible
lint: lint-install
$(shell which golangci-lint) run

# Install the binary globally with aliases
install:
Expand All @@ -41,4 +48,4 @@ uninstall:
rm -f $(INSTALL_DIR)/$(ALIAS_NAME)

# Phony targets
.PHONY: all build run tidy
.PHONY: all build run tidy lint-install lint install uninstall

0 comments on commit eccd2ba

Please sign in to comment.