gohttpserver/Makefile

49 lines
1003 B
Makefile
Raw Permalink Normal View History

2020-09-30 06:35:07 +00:00
FN := http
VERSION := $(shell git describe --always --dirty=-dirty)
ARCH := $(shell uname -m)
2020-09-30 06:35:07 +00:00
UNAME_S := $(shell uname -s)
GOLDFLAGS += -X main.Version=$(VERSION)
GOLDFLAGS += -X main.Buildarch=$(ARCH)
GOFLAGS := -ldflags "$(GOLDFLAGS)"
2020-09-30 06:35:07 +00:00
default: clean debug
2020-09-30 06:35:07 +00:00
commit: fmt lint
git commit -a
2020-10-04 21:32:06 +00:00
# get golangci-lint with:
# go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.31.0
2020-10-10 15:08:37 +00:00
# get gofumports with:
# go get mvdan.cc/gofumpt/gofumports
2020-09-30 06:35:07 +00:00
fmt:
gofumpt -l -w .
2020-09-30 06:35:07 +00:00
golangci-lint run --fix
lint:
golangci-lint run
sh -c 'test -z "$$(gofmt -l .)"'
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
run: ./$(FN)d
2020-09-30 06:35:07 +00:00
./$(FN)d
clean:
-rm -f ./$(FN)d debug.log
docker:
2020-10-04 21:32:06 +00:00
docker build --progress plain .
2020-09-30 06:35:07 +00:00
./$(FN)d: cmd/$(FN)d/main.go internal/*/*.go templates/* static/*
cd ./cmd/$(FN)d && \
go build -o ../../$(FN)d $(GOFLAGS) .
2020-10-29 00:47:37 +00:00
tools:
2020-10-29 00:47:37 +00:00
go get -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.31.0
go get -v mvdan.cc/gofumpt/gofumports