2021-07-15 20:27:24 +00:00
|
|
|
ABRA := ./cmd/abra
|
2021-07-15 13:26:02 +00:00
|
|
|
COMMIT := $(shell git rev-list -1 HEAD)
|
|
|
|
GOPATH := $(shell go env GOPATH)
|
2021-09-07 07:29:34 +00:00
|
|
|
LDFLAGS := "-X 'main.Commit=$(COMMIT)'"
|
2021-07-21 07:20:17 +00:00
|
|
|
DIST_LDFLAGS := $(LDFLAGS)" -s -w"
|
2021-08-13 12:28:18 +00:00
|
|
|
export GOPRIVATE=coopcloud.tech
|
2021-07-15 12:19:05 +00:00
|
|
|
|
2021-07-19 13:38:19 +00:00
|
|
|
all: run test install build clean format check static
|
2021-07-13 22:47:47 +00:00
|
|
|
|
|
|
|
run:
|
2021-07-15 21:01:31 +00:00
|
|
|
@go run -ldflags=$(LDFLAGS) $(ABRA)
|
2021-07-15 13:26:02 +00:00
|
|
|
|
2021-07-15 12:19:05 +00:00
|
|
|
install:
|
2021-07-15 21:01:31 +00:00
|
|
|
@go install -ldflags=$(LDFLAGS) $(ABRA)
|
2021-07-15 13:26:02 +00:00
|
|
|
|
2021-07-21 07:20:17 +00:00
|
|
|
build-dev:
|
2021-07-15 21:01:31 +00:00
|
|
|
@go build -ldflags=$(LDFLAGS) $(ABRA)
|
2021-07-15 12:19:05 +00:00
|
|
|
|
2021-07-21 07:20:17 +00:00
|
|
|
build:
|
|
|
|
@go build -ldflags=$(DIST_LDFLAGS) $(ABRA)
|
|
|
|
|
2021-07-15 12:19:05 +00:00
|
|
|
clean:
|
2021-07-15 21:01:31 +00:00
|
|
|
@rm '$(GOPATH)/bin/abra'
|
2021-07-15 21:00:33 +00:00
|
|
|
|
|
|
|
format:
|
2021-07-15 21:01:31 +00:00
|
|
|
@gofmt -s -w .
|
2021-07-15 21:00:33 +00:00
|
|
|
|
|
|
|
check:
|
2021-07-15 21:01:31 +00:00
|
|
|
@test -z $$(gofmt -l .) || (echo "gofmt: formatting issue - run 'make format' to resolve" && exit 1)
|
2021-07-15 21:49:58 +00:00
|
|
|
|
|
|
|
static:
|
|
|
|
@staticcheck $(ABRA)
|
2021-07-19 13:38:19 +00:00
|
|
|
|
|
|
|
test:
|
2021-07-21 07:56:53 +00:00
|
|
|
@go test ./... -cover
|
2021-09-04 23:57:50 +00:00
|
|
|
|
|
|
|
loc:
|
|
|
|
@find . -name "*.go" | xargs wc -l
|