Makefile 710 B

1234567891011121314151617181920212223242526272829303132333435
  1. .PHONY: default build test benchmark fmt vet
  2. default: build
  3. build:
  4. go build ./...
  5. test:
  6. go test sigs.k8s.io/json/...
  7. benchmark:
  8. go test sigs.k8s.io/json -bench . -benchmem
  9. fmt:
  10. go mod tidy
  11. gofmt -s -w *.go
  12. vet:
  13. go vet sigs.k8s.io/json
  14. @echo "checking for external dependencies"
  15. @deps=$$(go mod graph); \
  16. if [ -n "$${deps}" ]; then \
  17. echo "only stdlib dependencies allowed, found:"; \
  18. echo "$${deps}"; \
  19. exit 1; \
  20. fi
  21. @echo "checking for unsafe use"
  22. @unsafe=$$(go list -f '{{.ImportPath}} depends on {{.Imports}}' sigs.k8s.io/json/... | grep unsafe || true); \
  23. if [ -n "$${unsafe}" ]; then \
  24. echo "no dependencies on unsafe allowed, found:"; \
  25. echo "$${unsafe}"; \
  26. exit 1; \
  27. fi