mirror of
https://github.com/jimeh/undent.git
synced 2026-02-19 11:56:39 +00:00
chore(makefile): minor cleanup and tweaks
This commit is contained in:
23
Makefile
23
Makefile
@@ -1,3 +1,4 @@
|
|||||||
|
GOMODNAME := $(shell grep 'module' go.mod | sed -e 's/^module //')
|
||||||
SOURCES := $(shell find . -name "*.go" -or -name "go.mod" -or -name "go.sum" \
|
SOURCES := $(shell find . -name "*.go" -or -name "go.mod" -or -name "go.sum" \
|
||||||
-or -name "Makefile")
|
-or -name "Makefile")
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ SHELL ?= /bin/bash
|
|||||||
SHELL := env \
|
SHELL := env \
|
||||||
GO111MODULE=on \
|
GO111MODULE=on \
|
||||||
GOBIN=$(CURDIR)/$(TOOLDIR) \
|
GOBIN=$(CURDIR)/$(TOOLDIR) \
|
||||||
CGO_ENABLED=1 \
|
CGO_ENABLED=0 \
|
||||||
PATH='$(CURDIR)/$(BINDIR):$(CURDIR)/$(TOOLDIR):$(PATH)' \
|
PATH='$(CURDIR)/$(BINDIR):$(CURDIR)/$(TOOLDIR):$(PATH)' \
|
||||||
$(SHELL)
|
$(SHELL)
|
||||||
|
|
||||||
@@ -34,7 +35,6 @@ SHELL := env \
|
|||||||
#
|
#
|
||||||
|
|
||||||
TOOLS += $(TOOLDIR)/gobin
|
TOOLS += $(TOOLDIR)/gobin
|
||||||
gobin: $(TOOLDIR)/gobin
|
|
||||||
$(TOOLDIR)/gobin:
|
$(TOOLDIR)/gobin:
|
||||||
GO111MODULE=off go get -u github.com/myitcv/gobin
|
GO111MODULE=off go get -u github.com/myitcv/gobin
|
||||||
|
|
||||||
@@ -42,9 +42,6 @@ $(TOOLDIR)/gobin:
|
|||||||
define tool # 1: binary-name, 2: go-import-path
|
define tool # 1: binary-name, 2: go-import-path
|
||||||
TOOLS += $(TOOLDIR)/$(1)
|
TOOLS += $(TOOLDIR)/$(1)
|
||||||
|
|
||||||
.PHONY: $(1)
|
|
||||||
$(1): $(TOOLDIR)/$(1)
|
|
||||||
|
|
||||||
$(TOOLDIR)/$(1): $(TOOLDIR)/gobin Makefile
|
$(TOOLDIR)/$(1): $(TOOLDIR)/gobin Makefile
|
||||||
gobin $(V) "$(2)"
|
gobin $(V) "$(2)"
|
||||||
endef
|
endef
|
||||||
@@ -75,25 +72,18 @@ clean-golden:
|
|||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test:
|
||||||
go test $(V) -count=1 -race $(TESTARGS) $(TEST)
|
CGO_ENABLED=1 go test $(V) -count=1 -race $(TESTARGS) $(TEST)
|
||||||
|
|
||||||
.PHONY: test-update-golden
|
|
||||||
test-update-golden:
|
|
||||||
@$(MAKE) test UPDATE_GOLDEN=1
|
|
||||||
|
|
||||||
.PHONY: regen-golden
|
|
||||||
regen-golden: clean-golden test-update-golden
|
|
||||||
|
|
||||||
.PHONY: test-deps
|
.PHONY: test-deps
|
||||||
test-deps:
|
test-deps:
|
||||||
go test all
|
go test all
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: golangci-lint
|
lint: $(TOOLDIR)/golangci-lint
|
||||||
GOGC=off golangci-lint $(V) run
|
GOGC=off golangci-lint $(V) run
|
||||||
|
|
||||||
.PHONY: format
|
.PHONY: format
|
||||||
format: gofumports
|
format: $(TOOLDIR)/gofumports
|
||||||
gofumports -w .
|
gofumports -w .
|
||||||
|
|
||||||
.SILENT: bench
|
.SILENT: bench
|
||||||
@@ -161,7 +151,8 @@ check-tidy:
|
|||||||
|
|
||||||
# Serve docs
|
# Serve docs
|
||||||
.PHONY: docs
|
.PHONY: docs
|
||||||
docs: godoc
|
docs: $(TOOLDIR)/godoc
|
||||||
|
$(info serving docs on http://127.0.0.1:6060/pkg/$(GOMODNAME)/)
|
||||||
@godoc -http=127.0.0.1:6060
|
@godoc -http=127.0.0.1:6060
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user