On 13/03/2025 16:28, Nicolas Peugnet wrote:
After investigation, this panic also occurs from an upstream checkout:
$ git checkout ab13479
$ go test ./pkg/generators/
E0313 16:22:11.669135 3181592 openapi.go:322] Error when generating:
StringToArray, StringToArray map[string]map[string]map[int]string
E0313 16:22:11.669232 3181592 openapi.go:322] Error when generating:
StringToArray, StringToArray map[int]string
E0313 16:22:11.669297 3181592 openapi.go:322] Error when generating:
Int, Int int
E0313 16:22:11.669358 3181592 openapi.go:322] Error when generating:
Struct, Struct struct{foo int}
E0313 16:22:11.669424 3181592 openapi.go:322] Error when generating:
List, List []base/foo.Item
E0313 16:22:11.669487 3181592 openapi.go:322] Error when generating:
Map, Map map[string]base/foo.Item
--- FAIL: TestCustomDef (3.04s)
panic: can't find import for sync [recovered]
panic: can't find import for sync
goroutine 69 [running]:
testing.tRunner.func1.2({0xb396c0, 0xc00baaf020})
/usr/lib/go-1.24/src/testing/testing.go:1734 +0x21c
testing.tRunner.func1()
/usr/lib/go-1.24/src/testing/testing.go:1737 +0x35e
panic({0xb396c0?, 0xc00baaf020?})
/usr/lib/go-1.24/src/runtime/panic.go:787 +0x132
k8s.io/gengo/generator.golangTrackerLocalName({0xd7ce20, 0xc0018c7aa0},
{{0xc00b3aaa40, 0x4}, {0xc00b90839d, 0x3}, {0x0, 0x0}})
/home/nicolas/go/pkg/mod/k8s.io/
gengo@v0.0.0-20230829151522-9cce18d56c01/generator/import_tracker.go:88
+0x2b4
k8s.io/gengo/generator.NewImportTrackerForPackage.func2({{0xc00b3aaa40,
0x4}, {0xc00b90839d, 0x3}, {0x0, 0x0}})
/home/nicolas/go/pkg/mod/k8s.io/
gengo@v0.0.0-20230829151522-9cce18d56c01/generator/import_tracker.go:48
+0x58
k8s.io/gengo/namer.(*DefaultImportTracker).AddSymbol(0xc0018c7aa0,
{{0xc00b3aaa40, 0x4}, {0xc00b90839d, 0x3}, {0x0, 0x0}})
/home/nicolas/go/pkg/mod/k8s.io/
gengo@v0.0.0-20230829151522-9cce18d56c01/namer/import_tracker.go:74 +0xe9
k8s.io/gengo/namer.(*DefaultImportTracker).AddType(0xc0018c7aa0,
0xc00b9343c0)
/home/nicolas/go/pkg/mod/k8s.io/
gengo@v0.0.0-20230829151522-9cce18d56c01/namer/import_tracker.go:94 +0x145
k8s.io/gengo/namer.(*rawNamer).Name(0xc0019596e0, 0xc00b9343c0)
/home/nicolas/go/pkg/mod/k8s.io/
gengo@v0.0.0-20230829151522-9cce18d56c01/namer/namer.go:328 +0x4bb
k8s.io/gengo/namer.tList.Less({{0xd74920, 0xc0019596e0}, {0xc00b404808,
0x655, 0x8ff}}, 0xc00ba95dd0?, 0x0)
/home/nicolas/go/pkg/mod/k8s.io/
gengo@v0.0.0-20230829151522-9cce18d56c01/namer/order.go:71 +0x4e
sort.partition({0xd7a820, 0xc00ba95dd0}, 0x0, 0x655, 0x40f725?)
/usr/lib/go-1.24/src/sort/zsortinterface.go:154 +0x175
sort.pdqsort({0xd7a820, 0xc00ba95dd0}, 0xbe3b80?, 0x41be01?, 0xc00ba95dd0?)
/usr/lib/go-1.24/src/sort/zsortinterface.go:114 +0x225
sort.Sort({0xd7a820, 0xc00ba95dd0})
/usr/lib/go-1.24/src/sort/sort.go:54 +0x54
k8s.io/gengo/namer.(*Orderer).OrderUniverse(0xc001993450?, 0xc5f5ba?)
/home/nicolas/go/pkg/mod/k8s.io/
gengo@v0.0.0-20230829151522-9cce18d56c01/namer/order.go:50 +0x1d4
k8s.io/kube-openapi/pkg/generators.construct(0xc000103a40, 0xc0000c3cd0,
{0xd74920, 0xc0019596e0})
/tmp/kube-openapi/pkg/generators/openapi_test.go:47 +0x205
k8s.io/kube-openapi/pkg/generators.testOpenAPITypeWriter(0xc000103a40,
{0xc965be, 0x138})
/tmp/kube-openapi/pkg/generators/openapi_test.go:68 +0x32c
k8s.io/kube-openapi/pkg/generators.TestCustomDef(0xc000103a40)
/tmp/kube-openapi/pkg/generators/openapi_test.go:987 +0x2b
testing.tRunner(0xc000103a40, 0xca3268)
/usr/lib/go-1.24/src/testing/testing.go:1792 +0xf4
created by testing.(*T).Run in goroutine 1
/usr/lib/go-1.24/src/testing/testing.go:1851 +0x413
FAIL k8s.io/kube-openapi/pkg/generators 3.217s
FAIL
It seems that it comes in fact from [gengo], which has been bumped to v2
at some point. The latest upstream version of kube-openapi does not
exhibit such a panic, so we probably will have to import newer versions
of both gengo and kube-openapi. I'll see what I can do.
[gengo]: https://github.com/kubernetes/gengo
I managed to update both [gengo] and [kube-openapi] to compatible
versions that I pushed to their respective repository. I also made a bit
of cleaning by the way.
I am in the process of running ratt on the 65 reverse dependencies, and
for now, out of 55 done, all passed (except the ones already failing in
unstable). So I am fairly confident that it won't break anything.
I still need someone to do the upload for me (I left the changelog as
UNRELEASED for now).
[gengo]: https://salsa.debian.org/go-team/packages/golang-k8s-gengo
[kube-openapi]:
https://salsa.debian.org/go-team/packages/golang-k8s-kube-openapi
--
Nicolas Peugnet