basic/mk/staticcheck.mk

19 lines
568 B
Makefile
Raw Permalink Normal View History

BIN ?= bin
STATICCHECK_VERSION ?= 2024.1.1
STATICCHECK_DIR ?= $(abspath $(BIN))/staticcheck
STATICCHECK_VERSION_DIR ?= $(STATICCHECK_DIR)/$(STATICCHECK_VERSION)
.PHONY: staticcheck-install staticcheck-run
# Install staticcheck
staticcheck-install:
@rm -rf $(STATICCHECK_DIR)
@mkdir $(STATICCHECK_DIR)
@GOBIN=$(STATICCHECK_VERSION_DIR) go install honnef.co/go/tools/cmd/staticcheck@$(STATICCHECK_VERSION)
$(STATICCHECK_VERSION_DIR): staticcheck-install
# Run staticcheck
staticcheck-run: $(STATICCHECK_VERSION_DIR)
@$(STATICCHECK_VERSION_DIR)/staticcheck ./...