Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Commit

Permalink
add staticcheck linter
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcz committed Jun 13, 2021
1 parent 7bf0388 commit 5985636
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LDFLAGS := -X github.com/tomcz/openldap_exporter.commit=${GITCOMMIT}
LDFLAGS := ${LDFLAGS} -X github.com/tomcz/openldap_exporter.tag=${GIT_TAG}

.PHONY: precommit
precommit: clean format build
precommit: clean format lint build

.PHONY: commit
commit: clean
Expand All @@ -26,6 +26,14 @@ endif
@echo "Running goimports ..."
@goimports -w -local github.com/tomcz/openldap_exporter $(shell find . -type f -name '*.go' | grep -v '/vendor/')

.PHONY: lint
lint:
ifeq (, $(shell which staticcheck))
go install honnef.co/go/tools/cmd/[email protected]
endif
@echo "Running staticcheck ..."
@staticcheck $(shell go list ./... | grep -v /vendor/)

compile = GOOS=$1 GOARCH=amd64 go build -ldflags "${LDFLAGS}" -o target/openldap_exporter-$1 ./cmd/openldap_exporter

.PHONY: build
Expand Down

0 comments on commit 5985636

Please sign in to comment.