Makefile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. WORKDIR=`pwd`
  2. default: build
  3. vet:
  4. go vet ./...
  5. tools:
  6. go get honnef.co/go/tools/cmd/staticcheck
  7. go get honnef.co/go/tools/cmd/gosimple
  8. go get honnef.co/go/tools/cmd/unused
  9. go get github.com/gordonklaus/ineffassign
  10. go get github.com/fzipp/gocyclo
  11. go get github.com/golang/lint/golint
  12. go get github.com/alexkohler/prealloc
  13. go get github.com/axw/gocov/gocov
  14. go get -u gopkg.in/matm/v1/gocov-html
  15. gometalinter:
  16. gometalinter --enable-all ./...
  17. lint:
  18. golint ./...
  19. staticcheck:
  20. staticcheck -ignore "$(shell cat .checkignore)" ./...
  21. gosimple:
  22. gosimple -ignore "$(shell cat .gosimpleignore)" ./...
  23. unused:
  24. unused ./...
  25. ineffassign:
  26. ineffassign .
  27. gocyclo:
  28. gocyclo -over 20 $(shell find . -name "*.go" |egrep -v "_testutils/*|vendor/*|pb\.go|_test\.go")
  29. prealloc:
  30. prealloc ./...
  31. check: staticcheck gosimple ineffassign
  32. doc:
  33. godoc -http=:6060
  34. deps:
  35. go list -f '{{ join .Deps "\n"}}' ./... |grep "/" | grep -v "github.com/smallnest/rpcx"| grep "\." | sort |uniq
  36. fmt:
  37. go fmt ./...
  38. build:
  39. go build ./...
  40. build-all:
  41. go build -tags "kcp quic ping utp" ./...
  42. test:
  43. go test -race -tags "kcp quic ping utp" ./...
  44. cover:
  45. gocov test ./... | gocov-html > cover.html
  46. open cover.html
  47. check-libs:
  48. GIT_TERMINAL_PROMPT=1 GO111MODULE=on go list -m -u all | column -t
  49. update-libs:
  50. GIT_TERMINAL_PROMPT=1 GO111MODULE=on go get -u -v ./...
  51. mod-tidy:
  52. GIT_TERMINAL_PROMPT=1 GO111MODULE=on go mod tidy