Makefile 716 B

1234567891011121314151617181920212223242526272829
  1. GO ?= go
  2. GOFMT ?= gofmt "-s"
  3. GOFILES := $(shell find . -name "*.go")
  4. VETPACKAGES ?= $(shell $(GO) list ./... | grep -v /example/)
  5. TAGS ?= $(shell git describe --tags 2>/dev/null || git rev-parse --short HEAD)
  6. .PHONY: fmt
  7. fmt:
  8. $(GOFMT) -w $(GOFILES)
  9. .PHONY: vet
  10. vet:
  11. $(GO) vet $(VETPACKAGES)
  12. .PHONY: lint
  13. lint:
  14. revive -exclude example/... -exclude cli/... -exclude vendor/... -exclude TEST -formatter friendly ./...
  15. .PHONY: build
  16. build:
  17. $(GO) build -race -tags "$(TAGS)" -o bin/yomo -trimpath -ldflags "-s -w" ./cmd/yomo/main.go
  18. .PHONY: test
  19. test:
  20. $(GO) test -race -covermode=atomic $(VETPACKAGES)
  21. .PHONY: coverage
  22. coverage:
  23. $(GO) test -v -race -coverprofile=coverage.txt -covermode=atomic $(VETPACKAGES)