aboutsummaryrefslogtreecommitdiff
TARGET = go-example
RUN_MODE ?= development
GO ?= go

$(TARGET): */*.go go.sum
	$(GO) build -o $@ ./cmd/main/

.PHONY: test
test:
	$(GO) test -cover -coverprofile=coverage.out -v ./...
	$(GO) tool cover -html=coverage.out -o cover.html
	rm coverage.out

.PHONY: lint
lint: fmt
	~/go/bin/golangci-lint run -v

.PHONY: clean
clean:
	rm $(TARGET)

.PHONY: fmt
fmt:
	~/go/bin/goimports -local www.thenautilus.net/cgit -w .
	~/go/bin/gci write -s Standard -s Default -s 'Prefix(www.thenautilus.net/cgit)' .
	~/go/bin/gofumpt -l -w .

.PHONY: run
run: $(TARGET)
	./$(TARGET) --verbose --log-format=console $(ARGS)

.PHONY: update
update:
	go get -u -t ./...