blob: 98f5ab75f9d7ccbf249cd7271c44303ed719ebd3 [file] [log] [blame]
vinodd213b092024-03-28 16:10:07 +05301GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '')
2GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest
3
4GO_SEC=$(shell which gosec 2> /dev/null || echo '')
5GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest
6
7GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '')
8GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest
9
10.PHONY: golangci-lint
11golangci-lint:
12 $(if $(GO_LINT), ,go install $(GO_LINT_URI))
13 @echo "##### Running golangci-lint"
14 golangci-lint run -v
15
16.PHONY: gosec
17gosec:
18 $(if $(GO_SEC), ,go install $(GO_SEC_URI))
19 @echo "##### Running gosec"
20 gosec ./...
21
22.PHONY: govulncheck
23govulncheck:
24 $(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI))
25 @echo "##### Running govulncheck"
26 govulncheck ./...
27
28.PHONY: verify
29verify: golangci-lint gosec govulncheck
30
31.PHONY: test
32test:
33 @echo "##### Running tests"
34 go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./...