Skip to content

Commit 7f536ce

Browse files
authored
chore: add update-golden-files to Makefile (#214)
1 parent 0d5a346 commit 7f536ce

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
scripts/envbuilder-*
2-
.registry-cache
2+
.registry-cache
3+
**/.gen-golden

Makefile

+11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
GOARCH := $(shell go env GOARCH)
22
PWD=$(shell pwd)
33

4+
GO_SRC_FILES := $(shell find . -type f -name '*.go' -not -name '*_test.go')
5+
GO_TEST_FILES := $(shell find . -type f -not -name '*.go' -name '*_test.go')
6+
GOLDEN_FILES := $(shell find . -type f -name '*.golden')
7+
48
fmt: $(shell find . -type f -name '*.go')
59
go run mvdan.cc/[email protected] -l -w .
610

@@ -10,6 +14,13 @@ develop:
1014
build: scripts/envbuilder-$(GOARCH)
1115
./scripts/build.sh
1216

17+
.PHONY: update-golden-files
18+
update-golden-files: .gen-golden
19+
20+
.gen-golden: $(GOLDEN_FILES) $(GO_SRC_FILES) $(GO_TEST_FILES)
21+
go test . -update
22+
@touch "$@"
23+
1324
docs: options.go
1425
go run ./scripts/docsgen/main.go
1526

options_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ func runCLI() envbuilder.Options {
181181
}
182182

183183
i := cmd.Invoke().WithOS()
184+
i.Args = []string{"--help"}
184185
fakeIO(i)
185186
err := i.Run()
186187
if err != nil {

0 commit comments

Comments
 (0)