test that go generated code if what is should be

This commit is contained in:
Adrien Delorme 2019-05-27 16:00:20 +02:00
parent 5a0b5e3944
commit 36ee40b2a1
2 changed files with 16 additions and 2 deletions

View File

@ -32,6 +32,11 @@ jobs:
steps:
- checkout
- run: make fmt-check
check-generate:
<<: *golang
steps:
- checkout
- run: make generate-check
build_linux:
<<: *golang
environment:
@ -80,6 +85,7 @@ workflows:
- build
- check-vendor-vs-mod
- check-fmt
- check-generate
- build_linux:
filters:
tags:

View File

@ -91,9 +91,17 @@ fmt-examples:
# source files.
generate: install-gen-deps ## Generate dynamically generated code
go generate ./...
go fmt -w common/bootcommand/boot_command.go
go fmt common/bootcommand/boot_command.go
goimports -w common/bootcommand/boot_command.go
go fmt -w command/plugin.go
go fmt command/plugin.go
generate-check: generate ## Check go code generation is on par
@echo "==> Checking that auto-generated code is not changed..."
@git diff --exit-code; if [ $$? -eq 1 ]; then \
echo "Found diffs in go generated code."; \
echo "You can use the command: \`make generate\` to reformat code."; \
exit 1; \
fi
test: mode-check vet ## Run unit tests
@go test $(TEST) $(TESTARGS) -timeout=3m