Makefile 871 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. PKGS := github.com/pkg/errors
  2. SRCDIRS := $(shell go list -f '{{.Dir}}' $(PKGS))
  3. GO := go
  4. check: test vet gofmt misspell unconvert staticcheck ineffassign unparam
  5. test:
  6. $(GO) test $(PKGS)
  7. vet: | test
  8. $(GO) vet $(PKGS)
  9. staticcheck:
  10. $(GO) get honnef.co/go/tools/cmd/staticcheck
  11. staticcheck -checks all $(PKGS)
  12. misspell:
  13. $(GO) get github.com/client9/misspell/cmd/misspell
  14. misspell \
  15. -locale GB \
  16. -error \
  17. *.md *.go
  18. unconvert:
  19. $(GO) get github.com/mdempsky/unconvert
  20. unconvert -v $(PKGS)
  21. ineffassign:
  22. $(GO) get github.com/gordonklaus/ineffassign
  23. find $(SRCDIRS) -name '*.go' | xargs ineffassign
  24. pedantic: check errcheck
  25. unparam:
  26. $(GO) get mvdan.cc/unparam
  27. unparam ./...
  28. errcheck:
  29. $(GO) get github.com/kisielk/errcheck
  30. errcheck $(PKGS)
  31. gofmt:
  32. @echo Checking code is gofmted
  33. @test -z "$(shell gofmt -s -l -d -e $(SRCDIRS) | tee /dev/stderr)"