Skip to content
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
9 changes: 9 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ jobs:
with:
go-version-file: go.mod
- run: make test
- name: Check tests/ generated code is up to date
run: |
make test-gen
if [ -n "$(git status --porcelain)" ]; then
echo "::error::Generated code is out of date; run 'make test-gen' and commit the result."
git status --porcelain
git diff
exit 1
fi
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SHELL := /bin/bash

BIN = $(GOBIN)/msgp

.PHONY: clean wipe install get-deps bench all
.PHONY: clean wipe install get-deps bench all test-gen

$(BIN): */*.go
@go install ./...
Expand All @@ -25,6 +25,14 @@ test: all
go test -covermode=atomic -coverprofile=cover.out ./...
cd tests && go test ./...

# Regenerate tests/*_gen*.go with the msgp built from this tree, rather than
# whatever msgp happens to be on PATH. CI runs this and fails on any diff.
test-gen:
@bindir=$$(mktemp -d) && \
go build -o "$$bindir/msgp" . && \
(cd tests && PATH="$$bindir:$$PATH" go generate ./...); \
status=$$?; rm -rf "$$bindir"; exit $$status

bench: all
go test -bench ./...

Expand Down
65 changes: 17 additions & 48 deletions tests/anydecl_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading