gitea

Development moved to Codeberg

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
  46. 46
  47. 47
  48. 48
  49. 49
GO_PACKAGE := github.com/6543/go-version

GO ?= go
GOFMT ?= gofmt -s
SHASUM ?= shasum -a 256

GO_SOURCES := $(shell find . -type f -name "*.go")

.PHONY: all
all: clean test

.PHONY: clean
clean:
	$(GO) clean -i ./...

.PHONY: fmt
fmt:
	$(GOFMT) -w $(GO_SOURCES)

.PHONY: fmt-check
fmt-check:
	# get all go files and run go fmt on them
	@diff=$$($(GOFMT) -d $(GO_SOURCES)); \
	if [ -n "$$diff" ]; then \
		echo "Please run 'make fmt' and commit the result:"; \
		echo "$${diff}"; \
		exit 1; \
	fi;

.PHONY: lint
lint: vet revive misspell

.PHONY: vet
vet:
	$(GO) vet $(GO_PACKAGE)

.PHONY: revive
revive:
	$(GO) get -u github.com/mgechev/revive; \
	revive -config .revive.toml || exit 1

.PHONY: misspell
misspell-check:
	$(GO) get -u github.com/client9/misspell/cmd/misspell; \
	misspell -error -i unknwon,destory $(GO_SOURCES)

.PHONY: test
test:
	$(GO) test -cover -coverprofile coverage.out || exit 1