diff --git a/cmd/libs/go2idl/args/args.go b/cmd/libs/go2idl/args/args.go index 4fd0d87c605..e3c86b94182 100644 --- a/cmd/libs/go2idl/args/args.go +++ b/cmd/libs/go2idl/args/args.go @@ -37,10 +37,12 @@ import ( // Default returns a defaulted GeneratorArgs. You may change the defaults // before calling AddFlags. func Default() *GeneratorArgs { - return &GeneratorArgs{ + generatorArgs := &GeneratorArgs{ OutputBase: DefaultSourceTree(), GoHeaderFilePath: filepath.Join(DefaultSourceTree(), "k8s.io/kubernetes/hack/boilerplate/boilerplate.go.txt"), } + generatorArgs.AddFlags(pflag.CommandLine) + return generatorArgs } // GeneratorArgs has arguments common to most generators. @@ -105,7 +107,6 @@ func DefaultSourceTree() string { // If you don't need any non-default behavior, use as: // args.Default().Execute(...) func (g *GeneratorArgs) Execute(nameSystems namer.NameSystems, defaultSystem string, pkgs func(*generator.Context, *GeneratorArgs) generator.Packages) error { - g.AddFlags(pflag.CommandLine) pflag.Parse() b, err := g.NewBuilder() diff --git a/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testType.go b/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testType.go index 155a68c91e5..8785eb6d7e4 100644 --- a/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testType.go +++ b/cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testType.go @@ -90,23 +90,11 @@ func (c *testTypes) Delete(name string, options *api.DeleteOptions) error { // DeleteCollection deletes a collection of objects. func (c *testTypes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { - if options == nil { - return c.client.Delete(). - NamespaceIfScoped(c.ns, len(c.ns) > 0). - Resource("testTypes"). - VersionedParams(&listOptions, api.Scheme). - Do(). - Error() - } - body, err := api.Scheme.EncodeToVersion(options, c.client.APIVersion().String()) - if err != nil { - return err - } return c.client.Delete(). NamespaceIfScoped(c.ns, len(c.ns) > 0). Resource("testTypes"). VersionedParams(&listOptions, api.Scheme). - Body(body). + Body(options). Do(). Error() } diff --git a/hack/after-build/run-codegen.sh b/hack/after-build/run-codegen.sh index a2cbf3e4a1e..c5de720e9b3 100755 --- a/hack/after-build/run-codegen.sh +++ b/hack/after-build/run-codegen.sh @@ -24,12 +24,15 @@ source "${KUBE_ROOT}/hack/lib/init.sh" kube::golang::setup_env setgen=$(kube::util::find-binary "set-gen") +clientgen=$(kube::util::find-binary "client-gen") # Please do not add any logic to this shell script. Add logic to the go code # that generates the set-gen program. # # This can be called with one flag, --verify-only, so it works for both the # update- and verify- scripts. +${clientgen} "$@" +${clientgen} -t "$@" ${setgen} "$@" -# You may add additional calls of code generators like set-gen below. +# You may add additional calls of code generators like set-gen above. diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 9d9da661d35..5417e158785 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -25,6 +25,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh" kube::golang::setup_env +"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/client-gen "${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/set-gen "${KUBE_ROOT}/hack/after-build/run-codegen.sh" "$@" diff --git a/hack/verify-codegen.sh b/hack/verify-codegen.sh index ae93e36efb7..fb28b9d50d8 100755 --- a/hack/verify-codegen.sh +++ b/hack/verify-codegen.sh @@ -25,6 +25,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh" kube::golang::setup_env +"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/client-gen "${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/set-gen "${KUBE_ROOT}/hack/after-build/run-codegen.sh" --verify-only