diff --git a/.gitignore b/.gitignore index 1636db2b..d2cf2655 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ scripts/envbuilder-* -.registry-cache \ No newline at end of file +.registry-cache +**/.gen-golden diff --git a/Makefile b/Makefile index 12086583..9c557991 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,10 @@ GOARCH := $(shell go env GOARCH) PWD=$(shell pwd) +GO_SRC_FILES := $(shell find . -type f -name '*.go' -not -name '*_test.go') +GO_TEST_FILES := $(shell find . -type f -not -name '*.go' -name '*_test.go') +GOLDEN_FILES := $(shell find . -type f -name '*.golden') + fmt: $(shell find . -type f -name '*.go') go run mvdan.cc/gofumpt@v0.6.0 -l -w . @@ -10,6 +14,13 @@ develop: build: scripts/envbuilder-$(GOARCH) ./scripts/build.sh +.PHONY: update-golden-files +update-golden-files: .gen-golden + +.gen-golden: $(GOLDEN_FILES) $(GO_SRC_FILES) $(GO_TEST_FILES) + go test . -update + @touch "$@" + docs: options.go go run ./scripts/docsgen/main.go diff --git a/options_test.go b/options_test.go index 14dfd182..e32af9e6 100644 --- a/options_test.go +++ b/options_test.go @@ -181,6 +181,7 @@ func runCLI() envbuilder.Options { } i := cmd.Invoke().WithOS() + i.Args = []string{"--help"} fakeIO(i) err := i.Run() if err != nil {