diff --git a/cmd/libs/go2idl/go-to-protobuf/protobuf/parser.go b/cmd/libs/go2idl/go-to-protobuf/protobuf/parser.go index 22cc695b469..282108f5d55 100644 --- a/cmd/libs/go2idl/go-to-protobuf/protobuf/parser.go +++ b/cmd/libs/go2idl/go-to-protobuf/protobuf/parser.go @@ -132,7 +132,7 @@ func rewriteOptionalMethods(decl ast.Decl, isOptional OptionalFunc) { switch t.Name.Name { case "Unmarshal": ast.Walk(&optionalItemsVisitor{}, t.Body) - case "MarshalTo", "Size": + case "MarshalTo", "Size", "String": ast.Walk(&optionalItemsVisitor{}, t.Body) fallthrough case "Marshal": diff --git a/pkg/apis/authentication/v1beta1/generated.pb.go b/pkg/apis/authentication/v1beta1/generated.pb.go index 0adba13835c..2e6a00db6a2 100644 --- a/pkg/apis/authentication/v1beta1/generated.pb.go +++ b/pkg/apis/authentication/v1beta1/generated.pb.go @@ -376,16 +376,6 @@ func sovGenerated(x uint64) (n int) { func sozGenerated(x uint64) (n int) { return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (this *ExtraValue) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ExtraValue{`, - `Items:` + fmt.Sprintf("%v", this.Items) + `,`, - `}`, - }, "") - return s -} func (this *TokenReview) String() string { if this == nil { return "nil" diff --git a/pkg/apis/authentication/v1beta1/generated.proto b/pkg/apis/authentication/v1beta1/generated.proto index 03595a67f01..ac148e207d0 100644 --- a/pkg/apis/authentication/v1beta1/generated.proto +++ b/pkg/apis/authentication/v1beta1/generated.proto @@ -32,6 +32,7 @@ option go_package = "v1beta1"; // ExtraValue masks the value so protobuf can generate // +protobuf.nullable=true +// +protobuf.options.(gogoproto.goproto_stringer)=false message ExtraValue { // items, if empty, will result in an empty slice diff --git a/pkg/apis/authentication/v1beta1/types.go b/pkg/apis/authentication/v1beta1/types.go index b2b4471f6c1..fadd637abfd 100644 --- a/pkg/apis/authentication/v1beta1/types.go +++ b/pkg/apis/authentication/v1beta1/types.go @@ -17,6 +17,8 @@ limitations under the License. package v1beta1 import ( + "fmt" + "k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/api/v1" ) @@ -72,4 +74,9 @@ type UserInfo struct { // ExtraValue masks the value so protobuf can generate // +protobuf.nullable=true +// +protobuf.options.(gogoproto.goproto_stringer)=false type ExtraValue []string + +func (t ExtraValue) String() string { + return fmt.Sprintf("%v", []string(t)) +}