Makefile 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. .PHONY: help regenerate test dependencies build checkers action
  2. # Prefer tools that we've installed
  3. export PATH := $(HOME)/go/bin:$(PATH)
  4. help:
  5. @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
  6. regenerate: ## Re-generate lexers and parsers and pass through goimports
  7. go get github.com/goccmack/gocc
  8. go install github.com/goccmack/gocc
  9. gocc -zip -o ./internal/ dot.bnf
  10. find . -type f -name '*.go' | xargs goimports -w
  11. test: ## Perform package tests
  12. go test ./...
  13. dependencies: ## Grab necessary dependencies for checkers
  14. go version
  15. go get golang.org/x/tools/cmd/goimports
  16. go get github.com/kisielk/errcheck
  17. go get -u golang.org/x/lint/golint
  18. build: ## Perform build process
  19. go build .
  20. checkers: ## Run all checkers (errcheck, gofmt and golint)
  21. errcheck -ignore 'fmt:[FS]?[Pp]rint*' ./...
  22. gofmt -l -s -w .
  23. golint -set_exit_status
  24. git diff --exit-code
  25. action: dependencies regenerate build test checkers ## Run steps of github action