Skip to content

chore: add update-golden-files to Makefile #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
scripts/envbuilder-*
.registry-cache
.registry-cache
**/.gen-golden
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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/[email protected] -l -w .

Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ func runCLI() envbuilder.Options {
}

i := cmd.Invoke().WithOS()
i.Args = []string{"--help"}
fakeIO(i)
err := i.Run()
if err != nil {
Expand Down