fix String protobuf generator

This commit is contained in:
deads2k 2016-07-20 11:10:28 -04:00
parent 2c4a9f2e8d
commit 2256c6e619
4 changed files with 9 additions and 11 deletions

View File

@ -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":

View File

@ -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"

View File

@ -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

View File

@ -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))
}