diff --git a/.golangci.yaml b/.golangci.yaml index fe2c6f6..970bbcd 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -35,7 +35,7 @@ issues: linters: [ errcheck ] # Exclude certain revive standards from being applied in tests. - path: "_test\\.go" - text: "^(max-public-structs|function-length|cognitive-complexity|unchecked-type-assertion):" + text: "^(max-public-structs|function-length|cognitive-complexity):" linters: [ revive ] # Exclude dots in unfinished thoughts. - source: "(noinspection|TODO)" @@ -160,6 +160,9 @@ linters-settings: # Fails to disable writers that actually cannot return errors. - name: unhandled-error disabled: true + # Fails to detect and exclude type safe usages of type assertions. + - name: unchecked-type-assertion + disabled: true # Fails to restrict sufficiently in switches with numeric values. - name: add-constant disabled: true diff --git a/Makefile b/Makefile index 1d245ff..0c6489b 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,9 @@ endif # request targets, while the single target can be used to define the # precondition of custom target. .PHONY: $(TARGETS) $(addprefix target/,$(TARGETS)) -$(TARGETS):; $(GOBIN)/go-make $(MAKEFLAGS) $(MAKECMDGOALS); +$(TARGETS): + @PARAMS=$(MAKECMDGOALS) $(MAKECMDGOALS :=); \ + $(GOBIN)/go-make $(MAKEFLAGS) $${PARAMS}; $(addprefix target/,$(TARGETS)): target/%: $(GOBIN)/go-make $(MAKEFLAGS) $*; diff --git a/Makefile.base b/Makefile.base index 9c93af4..2c5de88 100644 --- a/Makefile.base +++ b/Makefile.base @@ -101,6 +101,7 @@ go-pkg = $(shell awk -v mode="$(1)" -v filter="$(3)" -v not="$(4)" ' \ }' <<<"$(2)") +BROWSER ?= xdg-open VERSION ?= snapshot ifeq ($(wildcard VERSION),VERSION) BUILD_VERSION := v$(shell cat VERSION) @@ -205,8 +206,9 @@ run-vars-image = $(call run-vars-docker) run-aws-setup = true ifneq ("$(wildcard Makefile.defs)","") - $(info info: please define custom functions in Makefile.defs) include Makefile.defs +else + $(warning info: please define custom functions in Makefile.defs) endif @@ -514,10 +516,12 @@ $(TARGETS_UNINSTALL): uninstall-%:; rm -f $(GOBIN)/$*; #@ initialize the project to prepare it for building. init: $(TARGETS_INIT) #@ initialize the go module and package dependencies. -init-go: go.mod go.sum +init-go: go.sum +go.sum: go.mod + go mod tidy -go=$(GOVERSION); go mod download; -go.mod go.sum: - go mod init "$(REPOSITORY)" +go.mod: + go mod init "$(REPOSITORY)"; #@ initialize the pre-commit hook. init-hooks: .git/hooks/pre-commit .git/hooks/pre-commit: diff --git a/Makefile.defs b/Makefile.defs new file mode 100644 index 0000000..8ac3ad0 --- /dev/null +++ b/Makefile.defs @@ -0,0 +1,24 @@ +# Setup environment for all run-targets (to be modified) +define run-setup + true +endef + +# Define variables for all run-targets (to be modified) +define run-vars + +endef + +# Define variables for local run-targets (to be modified) +define run-vars-local + +endef + +# Define variables for image run-targets (to be modified) +define run-vars-image + +endef + +# Define aws localstack setup (to be modified). +define run-aws-setup + true +endef diff --git a/Makefile.vars b/Makefile.vars index b1d9e25..8017797 100644 --- a/Makefile.vars +++ b/Makefile.vars @@ -9,11 +9,11 @@ CODACY_API_BASE_URL := https://api.codacy.com #CODACY_CONTINUE := true # Setup required targets before testing (default: ). -#TEST_DEPS := run-db +#TEST_DEPS := run-db run-aws # Setup required targets before running commands (default: ). -#RUN_DEPS := run-db +#RUN_DEPS := run-db run-aws # Setup required aws services for testing (default: ). -#AWS_SERVICES := +#AWS_SERVICES := s3 sqs # Setup when to push images (default: pulls [never, pulls, merges]) IMAGE_PUSH ?= never diff --git a/VERSION b/VERSION index 1750564..5a5831a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.6 +0.0.7 diff --git a/internal/make/fixtures/targets-trace.err b/internal/make/fixtures/targets-trace.err index d0f0d28..dbf319d 100644 --- a/internal/make/fixtures/targets-trace.err +++ b/internal/make/fixtures/targets-trace.err @@ -2,3 +2,4 @@ call: targets --trace info: {"path":"github.com/tkrop/go-make","repo":"git@github.com:tkrop/go-make","build":"0001-01-01T00:00:00Z","commit":"0001-01-01T00:00:00Z","dirty":true,"go":"{{GOVERSION}}","platform":"{{PLATFORM}}","compiler":"{{COMPILER}}"} exec: make --file Makefile.base targets --trace [go-make/internal/make] Makefile.base:18: info: please customize variables in Makefile.vars +Makefile.base:211: info: please define custom functions in Makefile.defs diff --git a/internal/make/fixtures/targets-trace.out b/internal/make/fixtures/targets-trace.out index 23ec485..d26cc29 100644 --- a/internal/make/fixtures/targets-trace.out +++ b/internal/make/fixtures/targets-trace.out @@ -1,4 +1,4 @@ -Makefile.base:383: target 'targets' does not exist +Makefile.base:385: target 'targets' does not exist make --no-builtin-rules --no-builtin-variables --print-data-base \ --question --makefile=Makefile.base 2>/dev/null | \ if [ "" != "raw" ]; then awk -v RS= -F: ' \ diff --git a/internal/make/fixtures/targets.err b/internal/make/fixtures/targets.err index 74c3efb..50784ee 100644 --- a/internal/make/fixtures/targets.err +++ b/internal/make/fixtures/targets.err @@ -1 +1,2 @@ Makefile.base:18: info: please customize variables in Makefile.vars +Makefile.base:211: info: please define custom functions in Makefile.defs