Commit d5050634 authored by deads2k's avatar deads2k

fix String protobuf generator

parent 60dd4a5d
...@@ -132,7 +132,7 @@ func rewriteOptionalMethods(decl ast.Decl, isOptional OptionalFunc) { ...@@ -132,7 +132,7 @@ func rewriteOptionalMethods(decl ast.Decl, isOptional OptionalFunc) {
switch t.Name.Name { switch t.Name.Name {
case "Unmarshal": case "Unmarshal":
ast.Walk(&optionalItemsVisitor{}, t.Body) ast.Walk(&optionalItemsVisitor{}, t.Body)
case "MarshalTo", "Size": case "MarshalTo", "Size", "String":
ast.Walk(&optionalItemsVisitor{}, t.Body) ast.Walk(&optionalItemsVisitor{}, t.Body)
fallthrough fallthrough
case "Marshal": case "Marshal":
......
...@@ -376,16 +376,6 @@ func sovGenerated(x uint64) (n int) { ...@@ -376,16 +376,6 @@ func sovGenerated(x uint64) (n int) {
func sozGenerated(x uint64) (n int) { func sozGenerated(x uint64) (n int) {
return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 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 { func (this *TokenReview) String() string {
if this == nil { if this == nil {
return "nil" return "nil"
......
...@@ -32,6 +32,7 @@ option go_package = "v1beta1"; ...@@ -32,6 +32,7 @@ option go_package = "v1beta1";
// ExtraValue masks the value so protobuf can generate // ExtraValue masks the value so protobuf can generate
// +protobuf.nullable=true // +protobuf.nullable=true
// +protobuf.options.(gogoproto.goproto_stringer)=false
message ExtraValue { message ExtraValue {
// items, if empty, will result in an empty slice // items, if empty, will result in an empty slice
......
...@@ -17,6 +17,8 @@ limitations under the License. ...@@ -17,6 +17,8 @@ limitations under the License.
package v1beta1 package v1beta1
import ( import (
"fmt"
"k8s.io/kubernetes/pkg/api/unversioned" "k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/api/v1"
) )
...@@ -72,4 +74,9 @@ type UserInfo struct { ...@@ -72,4 +74,9 @@ type UserInfo struct {
// ExtraValue masks the value so protobuf can generate // ExtraValue masks the value so protobuf can generate
// +protobuf.nullable=true // +protobuf.nullable=true
// +protobuf.options.(gogoproto.goproto_stringer)=false
type ExtraValue []string type ExtraValue []string
func (t ExtraValue) String() string {
return fmt.Sprintf("%v", []string(t))
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment