Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 9d912e8

Browse files
committed
Update/verify client generator in scripts
1 parent 5cf0659 commit 9d912e8

File tree

5 files changed

+10
-16
lines changed

5 files changed

+10
-16
lines changed

cmd/libs/go2idl/args/args.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ import (
3737
// Default returns a defaulted GeneratorArgs. You may change the defaults
3838
// before calling AddFlags.
3939
func Default() *GeneratorArgs {
40-
return &GeneratorArgs{
40+
generatorArgs := &GeneratorArgs{
4141
OutputBase: DefaultSourceTree(),
4242
GoHeaderFilePath: filepath.Join(DefaultSourceTree(), "k8s.io/kubernetes/hack/boilerplate/boilerplate.go.txt"),
4343
}
44+
generatorArgs.AddFlags(pflag.CommandLine)
45+
return generatorArgs
4446
}
4547

4648
// GeneratorArgs has arguments common to most generators.
@@ -105,7 +107,6 @@ func DefaultSourceTree() string {
105107
// If you don't need any non-default behavior, use as:
106108
// args.Default().Execute(...)
107109
func (g *GeneratorArgs) Execute(nameSystems namer.NameSystems, defaultSystem string, pkgs func(*generator.Context, *GeneratorArgs) generator.Packages) error {
108-
g.AddFlags(pflag.CommandLine)
109110
pflag.Parse()
110111

111112
b, err := g.NewBuilder()

cmd/libs/go2idl/client-gen/testoutput/testgroup/unversioned/testType.go

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,11 @@ func (c *testTypes) Delete(name string, options *api.DeleteOptions) error {
9090

9191
// DeleteCollection deletes a collection of objects.
9292
func (c *testTypes) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
93-
if options == nil {
94-
return c.client.Delete().
95-
NamespaceIfScoped(c.ns, len(c.ns) > 0).
96-
Resource("testTypes").
97-
VersionedParams(&listOptions, api.Scheme).
98-
Do().
99-
Error()
100-
}
101-
body, err := api.Scheme.EncodeToVersion(options, c.client.APIVersion().String())
102-
if err != nil {
103-
return err
104-
}
10593
return c.client.Delete().
10694
NamespaceIfScoped(c.ns, len(c.ns) > 0).
10795
Resource("testTypes").
10896
VersionedParams(&listOptions, api.Scheme).
109-
Body(body).
97+
Body(options).
11098
Do().
11199
Error()
112100
}

hack/after-build/run-codegen.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
2424
kube::golang::setup_env
2525

2626
setgen=$(kube::util::find-binary "set-gen")
27+
clientgen=$(kube::util::find-binary "client-gen")
2728

2829
# Please do not add any logic to this shell script. Add logic to the go code
2930
# that generates the set-gen program.
3031
#
3132
# This can be called with one flag, --verify-only, so it works for both the
3233
# update- and verify- scripts.
34+
${clientgen} "$@"
35+
${clientgen} -t "$@"
3336
${setgen} "$@"
3437

35-
# You may add additional calls of code generators like set-gen below.
38+
# You may add additional calls of code generators like set-gen above.

hack/update-codegen.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
2525

2626
kube::golang::setup_env
2727

28+
"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/client-gen
2829
"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/set-gen
2930

3031
"${KUBE_ROOT}/hack/after-build/run-codegen.sh" "$@"

hack/verify-codegen.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
2525

2626
kube::golang::setup_env
2727

28+
"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/client-gen
2829
"${KUBE_ROOT}/hack/build-go.sh" cmd/libs/go2idl/set-gen
2930

3031
"${KUBE_ROOT}/hack/after-build/run-codegen.sh" --verify-only

0 commit comments

Comments
 (0)