core: do not format deepcopy-gen files

deepcopy-gen appends a header starting with `// +build` which makes
gofmt to complain in Go 1.17 so until this is fixed in
https://github.com/kubernetes/gengo/pull/210 let's skip those files for
formatting.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2021-08-24 12:03:17 +02:00
1 parent 7c14b32435
commit cd9754e2f1
2 files changed
+5 -1

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
//go:build crds
// +build crds
/*
+4 -1
View File
@@ -156,7 +156,10 @@ go.vet:
.PHONY: go.fmt
go.fmt: $(GOFMT)
@gofmt_out=$$($(GOFMT) -s -d -e $(GO_SUBDIRS) $(GO_INTEGRATION_TESTS_SUBDIRS) 2>&1) && [ -z "$${gofmt_out}" ] || (echo "$${gofmt_out}" 1>&2; exit 1)
# ignore deepcopy generated files since the tool hardcoded the header with a "// +build" which in Golang 1.17 makes it fail gofmt since "////go:build" is preferred
# see: https://github.com/kubernetes/gengo/blob/master/examples/deepcopy-gen/generators/deepcopy.go#L136
# https://github.com/kubernetes/gengo/pull/210
@gofmt_out=$$(find . -name "*.go" -not -name "*.deepcopy.go" | xargs $(GOFMT) -s -d -e 2>&1) && [ -z "$${gofmt_out}" ] || (echo "$${gofmt_out}" 1>&2; exit 1)
go.validate: go.vet go.fmt