您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

35 行
946 B

  1. GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '')
  2. GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest
  3. GO_SEC=$(shell which gosec 2> /dev/null || echo '')
  4. GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest
  5. GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '')
  6. GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest
  7. .PHONY: verify
  8. verify: sec govulncheck lint test
  9. .PHONY: lint
  10. lint:
  11. $(if $(GO_LINT), ,go install $(GO_LINT_URI))
  12. @echo "##### Running golangci-lint #####"
  13. golangci-lint run -v
  14. .PHONY: sec
  15. sec:
  16. $(if $(GO_SEC), ,go install $(GO_SEC_URI))
  17. @echo "##### Running gosec #####"
  18. gosec ./...
  19. .PHONY: govulncheck
  20. govulncheck:
  21. $(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI))
  22. @echo "##### Running govulncheck #####"
  23. govulncheck ./...
  24. .PHONY: test
  25. test:
  26. @echo "##### Running tests #####"
  27. go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./...