2020-10-01 04:59:20 +00:00
|
|
|
ARCH := $(shell uname -m)
|
|
|
|
VERSION := $(shell git describe --always --dirty=-dirty --exclude="*")
|
2020-09-30 06:35:07 +00:00
|
|
|
|
|
|
|
FN := http
|
|
|
|
|
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
|
|
|
|
GOLDFLAGS += -X main.Version=$(VERSION)
|
2020-10-01 04:59:20 +00:00
|
|
|
GOLDFLAGS += -X main.Buildarch=$(ARCH)
|
|
|
|
GOFLAGS := -ldflags "$(GOLDFLAGS)"
|
2020-09-30 06:35:07 +00:00
|
|
|
|
|
|
|
default: debug
|
|
|
|
|
|
|
|
commit: fmt lint
|
|
|
|
git commit -a
|
|
|
|
|
|
|
|
fmt:
|
|
|
|
goimports -l -w .
|
|
|
|
golangci-lint run --fix
|
|
|
|
|
|
|
|
lint:
|
|
|
|
golangci-lint run
|
|
|
|
sh -c 'test -z "$$(gofmt -l .)"'
|
|
|
|
|
2020-09-30 08:12:59 +00:00
|
|
|
debug: ./$(FN)d
|
2020-09-30 06:35:07 +00:00
|
|
|
DEBUG=1 GOTRACEBACK=all ./$(FN)d
|
|
|
|
|
|
|
|
debugger:
|
|
|
|
cd cmd/$(FN)d && dlv debug main.go
|
|
|
|
|
2020-09-30 08:12:59 +00:00
|
|
|
run: ./$(FN)d
|
2020-09-30 06:35:07 +00:00
|
|
|
./$(FN)d
|
|
|
|
|
|
|
|
clean:
|
|
|
|
-rm -f ./$(FN)d debug.log
|
|
|
|
|
|
|
|
docker:
|
|
|
|
docker build .
|
|
|
|
|
|
|
|
get:
|
|
|
|
cd cmd/$(FN)d && go get -v
|
|
|
|
|
2020-09-30 08:12:59 +00:00
|
|
|
./$(FN)d: cmd/$(FN)d/main.go */*.go get
|
2020-09-30 06:35:07 +00:00
|
|
|
cd cmd/$(FN)d && go build -o ../../$(FN)d $(GOFLAGS) .
|