Fix lint in code-generator/cmd/...
Later commits touch code around here, which triggers verify. This commit JUST fixes lint.
This commit is contained in:
		@@ -171,9 +171,5 @@ func requiresApplyConfiguration(t *types.Type) bool {
 | 
			
		||||
			hasJSONTaggedMembers = true
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if !hasJSONTaggedMembers {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true
 | 
			
		||||
	return hasJSONTaggedMembers
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -129,7 +129,9 @@ func (p *groupVersionsBuilder) update() error {
 | 
			
		||||
 | 
			
		||||
		versionPkg := types.PackageVersion{Package: path.Join(p.importBasePath, pth, gv.Group.NonEmpty(), gv.Version.String()), Version: gv.Version}
 | 
			
		||||
		if group, ok := seenGroups[gv.Group]; ok {
 | 
			
		||||
			seenGroups[gv.Group].Versions = append(group.Versions, versionPkg)
 | 
			
		||||
			vers := group.Versions
 | 
			
		||||
			vers = append(vers, versionPkg)
 | 
			
		||||
			seenGroups[gv.Group].Versions = vers
 | 
			
		||||
		} else {
 | 
			
		||||
			seenGroups[gv.Group] = &types.GroupVersions{
 | 
			
		||||
				PackageName: gv.Group.NonEmpty(),
 | 
			
		||||
 
 | 
			
		||||
@@ -299,7 +299,9 @@ func (g *genFakeForType) GenerateType(c *generator.Context, t *types.Type, w io.
 | 
			
		||||
// TODO: Make the verbs in templates parametrized so the strings.Replace() is
 | 
			
		||||
// not needed.
 | 
			
		||||
func adjustTemplate(name, verbType, template string) string {
 | 
			
		||||
	return strings.Replace(template, " "+strings.Title(verbType), " "+name, -1)
 | 
			
		||||
	//nolint:staticcheck
 | 
			
		||||
	// TODO: convert this to use golang.org/x/text/cases
 | 
			
		||||
	return strings.ReplaceAll(template, " "+strings.Title(verbType), " "+name)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// template for the struct that implements the type's interface
 | 
			
		||||
 
 | 
			
		||||
@@ -120,8 +120,12 @@ func (g *genClientForType) GenerateType(c *generator.Context, t *types.Type, w i
 | 
			
		||||
		}
 | 
			
		||||
		var updatedVerbtemplate string
 | 
			
		||||
		if _, exists := subresourceDefaultVerbTemplates[e.VerbType]; e.IsSubresource() && exists {
 | 
			
		||||
			//nolint:staticcheck
 | 
			
		||||
			// TODO: convert this to use golang.org/x/text/cases
 | 
			
		||||
			updatedVerbtemplate = e.VerbName + "(" + strings.TrimPrefix(subresourceDefaultVerbTemplates[e.VerbType], strings.Title(e.VerbType)+"(")
 | 
			
		||||
		} else {
 | 
			
		||||
			//nolint:staticcheck
 | 
			
		||||
			// TODO: convert this to use golang.org/x/text/cases
 | 
			
		||||
			updatedVerbtemplate = e.VerbName + "(" + strings.TrimPrefix(defaultVerbTemplates[e.VerbType], strings.Title(e.VerbType)+"(")
 | 
			
		||||
		}
 | 
			
		||||
		extendedMethod := extendedInterfaceMethod{
 | 
			
		||||
@@ -345,7 +349,9 @@ func (g *genClientForType) GenerateType(c *generator.Context, t *types.Type, w i
 | 
			
		||||
// TODO: Make the verbs in templates parametrized so the strings.Replace() is
 | 
			
		||||
// not needed.
 | 
			
		||||
func adjustTemplate(name, verbType, template string) string {
 | 
			
		||||
	return strings.Replace(template, " "+strings.Title(verbType), " "+name, -1)
 | 
			
		||||
	//nolint:staticcheck
 | 
			
		||||
	// TODO: convert this to use golang.org/x/text/cases
 | 
			
		||||
	return strings.ReplaceAll(template, " "+strings.Title(verbType), " "+name)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func generateInterface(defaultVerbTemplates map[string]string, tags util.Tags) string {
 | 
			
		||||
 
 | 
			
		||||
@@ -116,6 +116,6 @@ func ToGroupInstallPackages(groups []GroupVersions, groupGoNames map[GroupVersio
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NormalizeGroupVersion calls normalizes the GroupVersion.
 | 
			
		||||
//func NormalizeGroupVersion(gv GroupVersion) GroupVersion {
 | 
			
		||||
//	return GroupVersion{Group: gv.Group.NonEmpty(), Version: gv.Version, NonEmptyVersion: normalization.Version(gv.Version)}
 | 
			
		||||
//}
 | 
			
		||||
// func NormalizeGroupVersion(gv GroupVersion) GroupVersion {
 | 
			
		||||
// 	 return GroupVersion{Group: gv.Group.NonEmpty(), Version: gv.Version, NonEmptyVersion: normalization.Version(gv.Version)}
 | 
			
		||||
// }
 | 
			
		||||
 
 | 
			
		||||
@@ -273,7 +273,8 @@ func GetTargets(context *generator.Context, arguments *args.GeneratorArgs) []gen
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Make sure explicit peer-packages are added.
 | 
			
		||||
	peers := append(customArgs.BasePeerDirs, customArgs.ExtraPeerDirs...)
 | 
			
		||||
	peers := customArgs.BasePeerDirs
 | 
			
		||||
	peers = append(peers, customArgs.ExtraPeerDirs...)
 | 
			
		||||
	if expanded, err := context.FindPackages(peers...); err != nil {
 | 
			
		||||
		klog.Fatalf("cannot find peer packages: %v", err)
 | 
			
		||||
	} else {
 | 
			
		||||
@@ -547,7 +548,8 @@ func (g *genConversion) convertibleOnlyWithinPackage(inType, outType *types.Type
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getExplicitFromTypes(t *types.Type) []types.Name {
 | 
			
		||||
	comments := append(t.SecondClosestCommentLines, t.CommentLines...)
 | 
			
		||||
	comments := t.SecondClosestCommentLines
 | 
			
		||||
	comments = append(comments, t.CommentLines...)
 | 
			
		||||
	paths := extractExplicitFromTag(comments)
 | 
			
		||||
	result := []types.Name{}
 | 
			
		||||
	for _, path := range paths {
 | 
			
		||||
@@ -688,10 +690,7 @@ func (g *genConversion) Init(c *generator.Context, w io.Writer) error {
 | 
			
		||||
	}
 | 
			
		||||
	// sort by name of the conversion function
 | 
			
		||||
	sort.Slice(pairs, func(i, j int) bool {
 | 
			
		||||
		if g.manualConversions[pairs[i]].Name.Name < g.manualConversions[pairs[j]].Name.Name {
 | 
			
		||||
			return true
 | 
			
		||||
		}
 | 
			
		||||
		return false
 | 
			
		||||
		return g.manualConversions[pairs[i]].Name.Name < g.manualConversions[pairs[j]].Name.Name
 | 
			
		||||
	})
 | 
			
		||||
	for _, pair := range pairs {
 | 
			
		||||
		args := argsFromType(pair.inType, pair.outType).With("Scope", types.Ref(conversionPackagePath, "Scope")).With("fn", g.manualConversions[pair])
 | 
			
		||||
@@ -725,7 +724,7 @@ func (g *genConversion) GenerateType(c *generator.Context, t *types.Type, w io.W
 | 
			
		||||
		}
 | 
			
		||||
		switch {
 | 
			
		||||
		case inType.Name.Package == "net/url" && inType.Name.Name == "Values":
 | 
			
		||||
			g.generateFromUrlValues(inType, t, sw)
 | 
			
		||||
			g.generateFromURLValues(inType, t, sw)
 | 
			
		||||
		default:
 | 
			
		||||
			klog.Errorf("Not supported input type: %#v", inType.Name)
 | 
			
		||||
		}
 | 
			
		||||
@@ -1081,7 +1080,7 @@ func (g *genConversion) doUnknown(inType, outType *types.Type, sw *generator.Sni
 | 
			
		||||
	sw.Do("// FIXME: Type $.|raw$ is unsupported.\n", inType)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (g *genConversion) generateFromUrlValues(inType, outType *types.Type, sw *generator.SnippetWriter) {
 | 
			
		||||
func (g *genConversion) generateFromURLValues(inType, outType *types.Type, sw *generator.SnippetWriter) {
 | 
			
		||||
	args := generator.Args{
 | 
			
		||||
		"inType":  inType,
 | 
			
		||||
		"outType": outType,
 | 
			
		||||
 
 | 
			
		||||
@@ -258,7 +258,8 @@ func Run(g *Generator) {
 | 
			
		||||
	// Alternately, we could generate into a temp path and then move the
 | 
			
		||||
	// resulting file back to the input dir, but that seems brittle in other
 | 
			
		||||
	// ways.
 | 
			
		||||
	args := append(searchArgs, fmt.Sprintf("--gogo_out=%s", g.OutputDir))
 | 
			
		||||
	args := searchArgs
 | 
			
		||||
	args = append(args, fmt.Sprintf("--gogo_out=%s", g.OutputDir))
 | 
			
		||||
 | 
			
		||||
	buf := &bytes.Buffer{}
 | 
			
		||||
	if len(g.Conditional) > 0 {
 | 
			
		||||
@@ -391,9 +392,9 @@ func importOrder(deps map[string][]string) ([]string, error) {
 | 
			
		||||
	if len(remainingNodes) > 0 {
 | 
			
		||||
		return nil, fmt.Errorf("cycle: remaining nodes: %#v, remaining edges: %#v", remainingNodes, graph)
 | 
			
		||||
	}
 | 
			
		||||
	//for _, n := range sorted {
 | 
			
		||||
	//	fmt.Println("topological order", n)
 | 
			
		||||
	//}
 | 
			
		||||
	// for _, n := range sorted {
 | 
			
		||||
	// 	 fmt.Println("topological order", n)
 | 
			
		||||
	// }
 | 
			
		||||
	return sorted, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -451,7 +452,5 @@ func (o positionOrder) Less(i, j int) bool {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (o positionOrder) Swap(i, j int) {
 | 
			
		||||
	x := o.elements[i]
 | 
			
		||||
	o.elements[i] = o.elements[j]
 | 
			
		||||
	o.elements[j] = x
 | 
			
		||||
	o.elements[i], o.elements[j] = o.elements[j], o.elements[i]
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -229,9 +229,8 @@ func (p protobufLocator) GoTypeForName(name types.Name) *types.Type {
 | 
			
		||||
 | 
			
		||||
// ProtoTypeFor locates a Protobuf type for the provided Go type (if possible).
 | 
			
		||||
func (p protobufLocator) ProtoTypeFor(t *types.Type) (*types.Type, error) {
 | 
			
		||||
	switch {
 | 
			
		||||
	// we've already converted the type, or it's a map
 | 
			
		||||
	case t.Kind == types.Protobuf || t.Kind == types.Map:
 | 
			
		||||
	if t.Kind == types.Protobuf || t.Kind == types.Map {
 | 
			
		||||
		p.tracker.AddType(t)
 | 
			
		||||
		return t, nil
 | 
			
		||||
	}
 | 
			
		||||
@@ -559,11 +558,11 @@ func protobufTagToField(tag string, field *protoField, m types.Member, t *types.
 | 
			
		||||
	// protobuf:"bytes,3,opt,name=Id,customtype=github.com/gogo/protobuf/test.Uuid"
 | 
			
		||||
	parts := strings.Split(tag, ",")
 | 
			
		||||
	if len(parts) < 3 {
 | 
			
		||||
		return fmt.Errorf("member %q of %q malformed 'protobuf' tag, not enough segments\n", m.Name, t.Name)
 | 
			
		||||
		return fmt.Errorf("member %q of %q malformed 'protobuf' tag, not enough segments", m.Name, t.Name)
 | 
			
		||||
	}
 | 
			
		||||
	protoTag, err := strconv.Atoi(parts[1])
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("member %q of %q malformed 'protobuf' tag, field ID is %q which is not an integer: %v\n", m.Name, t.Name, parts[1], err)
 | 
			
		||||
		return fmt.Errorf("member %q of %q malformed 'protobuf' tag, field ID is %q which is not an integer: %w", m.Name, t.Name, parts[1], err)
 | 
			
		||||
	}
 | 
			
		||||
	field.Tag = protoTag
 | 
			
		||||
 | 
			
		||||
@@ -584,7 +583,7 @@ func protobufTagToField(tag string, field *protoField, m types.Member, t *types.
 | 
			
		||||
			name = types.Name{
 | 
			
		||||
				Name:    parts[0][last+1:],
 | 
			
		||||
				Package: prefix,
 | 
			
		||||
				Path:    strings.Replace(prefix, ".", "/", -1),
 | 
			
		||||
				Path:    strings.ReplaceAll(prefix, ".", "/"),
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			name = types.Name{
 | 
			
		||||
@@ -603,7 +602,7 @@ func protobufTagToField(tag string, field *protoField, m types.Member, t *types.
 | 
			
		||||
	for i, extra := range parts[3:] {
 | 
			
		||||
		parts := strings.SplitN(extra, "=", 2)
 | 
			
		||||
		if len(parts) != 2 {
 | 
			
		||||
			return fmt.Errorf("member %q of %q malformed 'protobuf' tag, tag %d should be key=value, got %q\n", m.Name, t.Name, i+4, extra)
 | 
			
		||||
			return fmt.Errorf("member %q of %q malformed 'protobuf' tag, tag %d should be key=value, got %q", m.Name, t.Name, i+4, extra)
 | 
			
		||||
		}
 | 
			
		||||
		switch parts[0] {
 | 
			
		||||
		case "name":
 | 
			
		||||
 
 | 
			
		||||
@@ -87,8 +87,8 @@ func (n *protobufNamer) GoNameToProtoName(name types.Name) types.Name {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func protoSafePackage(name string) string {
 | 
			
		||||
	pkg := strings.Replace(name, "/", ".", -1)
 | 
			
		||||
	return strings.Replace(pkg, "-", "_", -1)
 | 
			
		||||
	pkg := strings.ReplaceAll(name, "/", ".")
 | 
			
		||||
	return strings.ReplaceAll(pkg, "-", "_")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type typeNameSet map[types.Name]*protobufPackage
 | 
			
		||||
 
 | 
			
		||||
@@ -111,8 +111,7 @@ func RewriteGeneratedGogoProtobufFile(name string, extractFn ExtractFunc, option
 | 
			
		||||
// TODO: move into upstream gogo-protobuf once https://github.com/gogo/protobuf/issues/181
 | 
			
		||||
// has agreement
 | 
			
		||||
func rewriteOptionalMethods(decl ast.Decl, isOptional OptionalFunc) {
 | 
			
		||||
	switch t := decl.(type) {
 | 
			
		||||
	case *ast.FuncDecl:
 | 
			
		||||
	if t, ok := decl.(*ast.FuncDecl); ok {
 | 
			
		||||
		ident, ptr, ok := receiver(t)
 | 
			
		||||
		if !ok {
 | 
			
		||||
			return
 | 
			
		||||
@@ -150,8 +149,7 @@ type optionalAssignmentVisitor struct {
 | 
			
		||||
// Visit walks the provided node, transforming field initializations of the form
 | 
			
		||||
// m.Field = &OptionalType{} -> m.Field = OptionalType{}
 | 
			
		||||
func (v optionalAssignmentVisitor) Visit(n ast.Node) ast.Visitor {
 | 
			
		||||
	switch t := n.(type) {
 | 
			
		||||
	case *ast.AssignStmt:
 | 
			
		||||
	if t, ok := n.(*ast.AssignStmt); ok {
 | 
			
		||||
		if len(t.Lhs) == 1 && len(t.Rhs) == 1 {
 | 
			
		||||
			if !isFieldSelector(t.Lhs[0], "m", "") {
 | 
			
		||||
				return nil
 | 
			
		||||
@@ -195,13 +193,11 @@ func (v *optionalItemsVisitor) Visit(n ast.Node) ast.Visitor {
 | 
			
		||||
					t.Lhs[0] = &ast.StarExpr{X: &ast.Ident{Name: "m"}}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			switch rhs := t.Rhs[0].(type) {
 | 
			
		||||
			case *ast.CallExpr:
 | 
			
		||||
			if rhs, ok := t.Rhs[0].(*ast.CallExpr); ok {
 | 
			
		||||
				if ident, ok := rhs.Fun.(*ast.Ident); ok && ident.Name == "append" {
 | 
			
		||||
					ast.Walk(v, rhs)
 | 
			
		||||
					if len(rhs.Args) > 0 {
 | 
			
		||||
						switch arg := rhs.Args[0].(type) {
 | 
			
		||||
						case *ast.Ident:
 | 
			
		||||
						if arg, ok := rhs.Args[0].(*ast.Ident); ok {
 | 
			
		||||
							if arg.Name == "m" {
 | 
			
		||||
								rhs.Args[0] = &ast.StarExpr{X: &ast.Ident{Name: "m"}}
 | 
			
		||||
							}
 | 
			
		||||
@@ -212,8 +208,7 @@ func (v *optionalItemsVisitor) Visit(n ast.Node) ast.Visitor {
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	case *ast.IfStmt:
 | 
			
		||||
		switch cond := t.Cond.(type) {
 | 
			
		||||
		case *ast.BinaryExpr:
 | 
			
		||||
		if cond, ok := t.Cond.(*ast.BinaryExpr); ok {
 | 
			
		||||
			if cond.Op == token.EQL {
 | 
			
		||||
				if isFieldSelector(cond.X, "m", "Items") && isIdent(cond.Y, "nil") {
 | 
			
		||||
					cond.X = &ast.StarExpr{X: &ast.Ident{Name: "m"}}
 | 
			
		||||
@@ -225,8 +220,7 @@ func (v *optionalItemsVisitor) Visit(n ast.Node) ast.Visitor {
 | 
			
		||||
			// if err := m[len(m.Items)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
 | 
			
		||||
			// 	return err
 | 
			
		||||
			// }
 | 
			
		||||
			switch s := t.Init.(type) {
 | 
			
		||||
			case *ast.AssignStmt:
 | 
			
		||||
			if s, ok := t.Init.(*ast.AssignStmt); ok {
 | 
			
		||||
				if call, ok := s.Rhs[0].(*ast.CallExpr); ok {
 | 
			
		||||
					if sel, ok := call.Fun.(*ast.SelectorExpr); ok {
 | 
			
		||||
						if x, ok := sel.X.(*ast.IndexExpr); ok {
 | 
			
		||||
@@ -302,15 +296,13 @@ func receiver(f *ast.FuncDecl) (ident *ast.Ident, pointer bool, ok bool) {
 | 
			
		||||
// dropExistingTypeDeclarations removes any type declaration for which extractFn returns true. The function
 | 
			
		||||
// returns true if the entire declaration should be dropped.
 | 
			
		||||
func dropExistingTypeDeclarations(decl ast.Decl, extractFn ExtractFunc) bool {
 | 
			
		||||
	switch t := decl.(type) {
 | 
			
		||||
	case *ast.GenDecl:
 | 
			
		||||
	if t, ok := decl.(*ast.GenDecl); ok {
 | 
			
		||||
		if t.Tok != token.TYPE {
 | 
			
		||||
			return false
 | 
			
		||||
		}
 | 
			
		||||
		specs := []ast.Spec{}
 | 
			
		||||
		for _, s := range t.Specs {
 | 
			
		||||
			switch spec := s.(type) {
 | 
			
		||||
			case *ast.TypeSpec:
 | 
			
		||||
			if spec, ok := s.(*ast.TypeSpec); ok {
 | 
			
		||||
				if extractFn(spec) {
 | 
			
		||||
					continue
 | 
			
		||||
				}
 | 
			
		||||
@@ -329,15 +321,13 @@ func dropExistingTypeDeclarations(decl ast.Decl, extractFn ExtractFunc) bool {
 | 
			
		||||
// to prevent generation from being able to define side-effects.  The function returns true
 | 
			
		||||
// if the entire declaration should be dropped.
 | 
			
		||||
func dropEmptyImportDeclarations(decl ast.Decl) bool {
 | 
			
		||||
	switch t := decl.(type) {
 | 
			
		||||
	case *ast.GenDecl:
 | 
			
		||||
	if t, ok := decl.(*ast.GenDecl); ok {
 | 
			
		||||
		if t.Tok != token.IMPORT {
 | 
			
		||||
			return false
 | 
			
		||||
		}
 | 
			
		||||
		specs := []ast.Spec{}
 | 
			
		||||
		for _, s := range t.Specs {
 | 
			
		||||
			switch spec := s.(type) {
 | 
			
		||||
			case *ast.ImportSpec:
 | 
			
		||||
			if spec, ok := s.(*ast.ImportSpec); ok {
 | 
			
		||||
				if spec.Name != nil && spec.Name.Name == "_" {
 | 
			
		||||
					continue
 | 
			
		||||
				}
 | 
			
		||||
 
 | 
			
		||||
@@ -107,10 +107,8 @@ func TestProtoParser(t *testing.T) {
 | 
			
		||||
		if !test.err {
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				t.Errorf("%s: unexpected error %s", test.expr, err)
 | 
			
		||||
			} else {
 | 
			
		||||
				if actual != ident.Name {
 | 
			
		||||
					t.Errorf("%s: expected %s, got %s", test.expr, ident.Name, actual)
 | 
			
		||||
				}
 | 
			
		||||
			} else if actual != ident.Name {
 | 
			
		||||
				t.Errorf("%s: expected %s, got %s", test.expr, ident.Name, actual)
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			if err == nil {
 | 
			
		||||
 
 | 
			
		||||
@@ -237,25 +237,25 @@ func (g *listerGenerator) GenerateType(c *generator.Context, t *types.Type, w io
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if tags.NonNamespaced {
 | 
			
		||||
		sw.Do(typeListerInterface_NonNamespaced, m)
 | 
			
		||||
		sw.Do(typeListerInterfaceNonNamespaced, m)
 | 
			
		||||
	} else {
 | 
			
		||||
		sw.Do(typeListerInterface, m)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sw.Do(typeListerStruct, m)
 | 
			
		||||
	sw.Do(typeListerConstructor, m)
 | 
			
		||||
	sw.Do(typeLister_List, m)
 | 
			
		||||
	sw.Do(typeListerList, m)
 | 
			
		||||
 | 
			
		||||
	if tags.NonNamespaced {
 | 
			
		||||
		sw.Do(typeLister_NonNamespacedGet, m)
 | 
			
		||||
		sw.Do(typeListerNonNamespacedGet, m)
 | 
			
		||||
		return sw.Error()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sw.Do(typeLister_NamespaceLister, m)
 | 
			
		||||
	sw.Do(typeListerNamespaceLister, m)
 | 
			
		||||
	sw.Do(namespaceListerInterface, m)
 | 
			
		||||
	sw.Do(namespaceListerStruct, m)
 | 
			
		||||
	sw.Do(namespaceLister_List, m)
 | 
			
		||||
	sw.Do(namespaceLister_Get, m)
 | 
			
		||||
	sw.Do(namespaceListerList, m)
 | 
			
		||||
	sw.Do(namespaceListerGet, m)
 | 
			
		||||
 | 
			
		||||
	return sw.Error()
 | 
			
		||||
}
 | 
			
		||||
@@ -273,7 +273,7 @@ type $.type|public$Lister interface {
 | 
			
		||||
}
 | 
			
		||||
`
 | 
			
		||||
 | 
			
		||||
var typeListerInterface_NonNamespaced = `
 | 
			
		||||
var typeListerInterfaceNonNamespaced = `
 | 
			
		||||
// $.type|public$Lister helps list $.type|publicPlural$.
 | 
			
		||||
// All objects returned here must be treated as read-only.
 | 
			
		||||
type $.type|public$Lister interface {
 | 
			
		||||
@@ -301,7 +301,7 @@ func New$.type|public$Lister(indexer cache.Indexer) $.type|public$Lister {
 | 
			
		||||
}
 | 
			
		||||
`
 | 
			
		||||
 | 
			
		||||
var typeLister_List = `
 | 
			
		||||
var typeListerList = `
 | 
			
		||||
// List lists all $.type|publicPlural$ in the indexer.
 | 
			
		||||
func (s *$.type|private$Lister) List(selector labels.Selector) (ret []*$.type|raw$, err error) {
 | 
			
		||||
	err = cache.ListAll(s.indexer, selector, func(m interface{}) {
 | 
			
		||||
@@ -311,14 +311,14 @@ func (s *$.type|private$Lister) List(selector labels.Selector) (ret []*$.type|ra
 | 
			
		||||
}
 | 
			
		||||
`
 | 
			
		||||
 | 
			
		||||
var typeLister_NamespaceLister = `
 | 
			
		||||
var typeListerNamespaceLister = `
 | 
			
		||||
// $.type|publicPlural$ returns an object that can list and get $.type|publicPlural$.
 | 
			
		||||
func (s *$.type|private$Lister) $.type|publicPlural$(namespace string) $.type|public$NamespaceLister {
 | 
			
		||||
	return $.type|private$NamespaceLister{indexer: s.indexer, namespace: namespace}
 | 
			
		||||
}
 | 
			
		||||
`
 | 
			
		||||
 | 
			
		||||
var typeLister_NonNamespacedGet = `
 | 
			
		||||
var typeListerNonNamespacedGet = `
 | 
			
		||||
// Get retrieves the $.type|public$ from the index for a given name.
 | 
			
		||||
func (s *$.type|private$Lister) Get(name string) (*$.type|raw$, error) {
 | 
			
		||||
  obj, exists, err := s.indexer.GetByKey(name)
 | 
			
		||||
@@ -355,7 +355,7 @@ type $.type|private$NamespaceLister struct {
 | 
			
		||||
}
 | 
			
		||||
`
 | 
			
		||||
 | 
			
		||||
var namespaceLister_List = `
 | 
			
		||||
var namespaceListerList = `
 | 
			
		||||
// List lists all $.type|publicPlural$ in the indexer for a given namespace.
 | 
			
		||||
func (s $.type|private$NamespaceLister) List(selector labels.Selector) (ret []*$.type|raw$, err error) {
 | 
			
		||||
	err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
 | 
			
		||||
@@ -365,7 +365,7 @@ func (s $.type|private$NamespaceLister) List(selector labels.Selector) (ret []*$
 | 
			
		||||
}
 | 
			
		||||
`
 | 
			
		||||
 | 
			
		||||
var namespaceLister_Get = `
 | 
			
		||||
var namespaceListerGet = `
 | 
			
		||||
// Get retrieves the $.type|public$ from the indexer for a given namespace and name.
 | 
			
		||||
func (s $.type|private$NamespaceLister) Get(name string) (*$.type|raw$, error) {
 | 
			
		||||
	obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
 | 
			
		||||
 
 | 
			
		||||
@@ -109,7 +109,7 @@ func extractReplacementTag(t *types.Type) (group, version, kind string, hasRepla
 | 
			
		||||
	}
 | 
			
		||||
	// If there are multiple values, abort.
 | 
			
		||||
	if len(tagVals) > 1 {
 | 
			
		||||
		return "", "", "", false, fmt.Errorf("Found %d %s tags: %q", len(tagVals), replacementTagName, tagVals)
 | 
			
		||||
		return "", "", "", false, fmt.Errorf("found %d %s tags: %q", len(tagVals), replacementTagName, tagVals)
 | 
			
		||||
	}
 | 
			
		||||
	tagValue := tagVals[0]
 | 
			
		||||
	parts := strings.Split(tagValue, ",")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user