kubernetes / code-generator

Generators for kube-like API types
Apache License 2.0
1.73k stars 415 forks source link

client-gen generates empty files when using Go 1.23 #176

Open JRBANCEL opened 3 months ago

JRBANCEL commented 3 months ago

We use client-gen like this:

client-gen \
        --input-base "github.com/<WHATEVER>/pkg/apis" \
        --input "dedicated/v1alpha1" \
        --output-pkg github.com/<WHATEVER>/pkg/clientset \
        --go-header-file hack/header.txt \
        --clientset-name versioned \
        --output-dir ./pkg/clientset

Works fine in 1.22.0 (and v0.30.1).

Now, when I bump go.mod to use 1.23.0, client-gen generates files with just the package statement:

// Code generated by client-gen. DO NOT EDIT.

package v1alpha1

Output with -v 10 doesn't show anything interesting. I tried to update client-gen to v0.31.0, same result.

Airblader commented 2 months ago

Several people in my team have the same issue with tooling like deepcopy-gen. Oddly, though, for me it seems to work.

luca-filipponi commented 2 months ago

@JRBANCEL try to clean the go mod cache go clean -modcache, this worked for us