mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Merge pull request #53579 from sttts/sttts-client-gen-groupname-comment-everywhere
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. generators: allow +groupName everywhere in doc.go ... not only directly above the package directive. Avoiding confusion as in https://github.com/kubernetes/kubernetes/issues/53498.
This commit is contained in:
commit
f7c8a7aa17
@ -250,7 +250,7 @@ func applyGroupOverrides(universe types.Universe, customArgs *clientgenargs.Cust
|
||||
changes := make(map[clientgentypes.GroupVersion]clientgentypes.GroupVersion)
|
||||
for gv, inputDir := range customArgs.GroupVersionToInputPath {
|
||||
p := universe.Package(inputDir)
|
||||
if override := types.ExtractCommentTags("+", p.DocComments)["groupName"]; override != nil {
|
||||
if override := types.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil {
|
||||
newGV := clientgentypes.GroupVersion{
|
||||
Group: clientgentypes.Group(strings.SplitN(override[0], ".", 2)[0]),
|
||||
Version: gv.Version,
|
||||
|
@ -102,7 +102,7 @@ func (g *genFakeForType) GenerateType(c *generator.Context, t *types.Type, w io.
|
||||
|
||||
// allow user to define a group name that's different from the one parsed from the directory.
|
||||
p := c.Universe.Package(path.Vendorless(g.inputPackage))
|
||||
if override := types.ExtractCommentTags("+", p.DocComments)["groupName"]; override != nil {
|
||||
if override := types.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil {
|
||||
groupName = override[0]
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ func (g *genGroup) GenerateType(c *generator.Context, t *types.Type, w io.Writer
|
||||
}
|
||||
// allow user to define a group name that's different from the one parsed from the directory.
|
||||
p := c.Universe.Package(path.Vendorless(g.inputPackage))
|
||||
if override := types.ExtractCommentTags("+", p.DocComments)["groupName"]; override != nil {
|
||||
if override := types.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil {
|
||||
groupName = override[0]
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
// 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 {
|
||||
if override := types.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil {
|
||||
gv.Group = clientgentypes.Group(strings.SplitN(override[0], ".", 2)[0])
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
// 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 {
|
||||
if override := types.ExtractCommentTags("+", p.Comments)["groupName"]; override != nil {
|
||||
gv.Group = clientgentypes.Group(strings.SplitN(override[0], ".", 2)[0])
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user