Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use groupName comment for listers/informers #45171

Merged
merged 1 commit into from
May 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmd/libs/go2idl/informer-gen/generators/packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
targetGroupVersions = externalGroupVersions
}

// If there's a comment of the form "// +groupName=somegroup" or
// "// +groupName=somegroup.foo.bar.io", use the first field (somegroup) as the name of the
// group when generating.
if override := types.ExtractCommentTags("+", p.DocComments)["groupName"]; override != nil {
gv.Group = clientgentypes.Group(strings.SplitN(override[0], ".", 2)[0])
}

var typesToGenerate []*types.Type
for _, t := range p.Types {
// filter out types which dont have genclient=true.
Expand Down
7 changes: 7 additions & 0 deletions cmd/libs/go2idl/lister-gen/generators/lister.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
internalGVPkg = strings.Join(parts[0:len(parts)-1], "/")
}

// If there's a comment of the form "// +groupName=somegroup" or
// "// +groupName=somegroup.foo.bar.io", use the first field (somegroup) as the name of the
// group when generating.
if override := types.ExtractCommentTags("+", p.DocComments)["groupName"]; override != nil {
gv.Group = clientgentypes.Group(strings.SplitN(override[0], ".", 2)[0])
}

var typesToGenerate []*types.Type
for _, t := range p.Types {
// filter out types which dont have genclient=true.
Expand Down