Merge pull request #23660 from goltermann/vetclean

Automatic merge from submit-queue

Additional go vet fixes

Mostly:
- pass lock by value
- bad syntax for struct tag value
- example functions not formatted properly
This commit is contained in:
k8s-merge-robot
2016-04-12 06:22:16 -07:00
33 changed files with 136 additions and 118 deletions

View File

@@ -101,7 +101,7 @@ func InterpretWatchError(err error, resource unversioned.GroupResource, name str
switch {
case storage.IsInvalidError(err):
invalidError, _ := err.(storage.InvalidError)
return errors.NewInvalid(unversioned.GroupKind{resource.Group, resource.Resource}, name, invalidError.Errs)
return errors.NewInvalid(unversioned.GroupKind{Group: resource.Group, Kind: resource.Resource}, name, invalidError.Errs)
default:
return err
}

View File

@@ -52,7 +52,7 @@ func BeforeDelete(strategy RESTDeleteStrategy, ctx api.Context, obj runtime.Obje
}
// Checking the Preconditions here to fail early. They'll be enforced later on when we actually do the deletion, too.
if options.Preconditions != nil && options.Preconditions.UID != nil && *options.Preconditions.UID != objectMeta.UID {
return false, false, errors.NewConflict(unversioned.GroupResource{gvk.Group, gvk.Kind}, objectMeta.Name, fmt.Errorf("the UID in the precondition (%s) does not match the UID in record (%s). The object might have been deleted and then recreated", *options.Preconditions.UID, objectMeta.UID))
return false, false, errors.NewConflict(unversioned.GroupResource{Group: gvk.Group, Resource: gvk.Kind}, objectMeta.Name, fmt.Errorf("the UID in the precondition (%s) does not match the UID in record (%s). The object might have been deleted and then recreated", *options.Preconditions.UID, objectMeta.UID))
}
gracefulStrategy, ok := strategy.(RESTGracefulDeleteStrategy)
if !ok {

View File

@@ -33273,11 +33273,12 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) {
yyq2[4] = len(x.Addresses) != 0
yyq2[5] = true
yyq2[6] = true
yyq2[7] = len(x.Images) != 0
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(8)
} else {
yynn2 = 1
yynn2 = 0
for _, b := range yyq2 {
if b {
yynn2++
@@ -33449,28 +33450,34 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) {
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if x.Images == nil {
r.EncodeNil()
} else {
yym29 := z.EncBinary()
_ = yym29
if false {
if yyq2[7] {
if x.Images == nil {
r.EncodeNil()
} else {
h.encSliceContainerImage(([]ContainerImage)(x.Images), e)
yym29 := z.EncBinary()
_ = yym29
if false {
} else {
h.encSliceContainerImage(([]ContainerImage)(x.Images), e)
}
}
} else {
r.EncodeNil()
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("images"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Images == nil {
r.EncodeNil()
} else {
yym30 := z.EncBinary()
_ = yym30
if false {
if yyq2[7] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("images"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Images == nil {
r.EncodeNil()
} else {
h.encSliceContainerImage(([]ContainerImage)(x.Images), e)
yym30 := z.EncBinary()
_ = yym30
if false {
} else {
h.encSliceContainerImage(([]ContainerImage)(x.Images), e)
}
}
}
}

View File

@@ -1671,8 +1671,14 @@ type NodeSpec struct {
// DaemonEndpoint contains information about a single Daemon endpoint.
type DaemonEndpoint struct {
/*
The port tag was not properly in quotes in earlier releases, so it must be
uppercased for backwards compat (since it was falling back to var name of
'Port').
*/
// Port number of the given endpoint.
Port int `json:port`
Port int `json:"Port"`
}
// NodeDaemonEndpoints lists ports opened by daemons running on the Node.
@@ -1718,7 +1724,7 @@ type NodeStatus struct {
// Set of ids/uuids to uniquely identify the node.
NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"`
// List of container images on this node
Images []ContainerImage `json:"images",omitempty`
Images []ContainerImage `json:"images,omitempty"`
}
// Describe a container image

View File

@@ -33155,11 +33155,12 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) {
yyq2[4] = len(x.Addresses) != 0
yyq2[5] = true
yyq2[6] = true
yyq2[7] = len(x.Images) != 0
var yynn2 int
if yyr2 || yy2arr2 {
r.EncodeArrayStart(8)
} else {
yynn2 = 1
yynn2 = 0
for _, b := range yyq2 {
if b {
yynn2++
@@ -33331,28 +33332,34 @@ func (x *NodeStatus) CodecEncodeSelf(e *codec1978.Encoder) {
}
if yyr2 || yy2arr2 {
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if x.Images == nil {
r.EncodeNil()
} else {
yym29 := z.EncBinary()
_ = yym29
if false {
if yyq2[7] {
if x.Images == nil {
r.EncodeNil()
} else {
h.encSliceContainerImage(([]ContainerImage)(x.Images), e)
yym29 := z.EncBinary()
_ = yym29
if false {
} else {
h.encSliceContainerImage(([]ContainerImage)(x.Images), e)
}
}
} else {
r.EncodeNil()
}
} else {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("images"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Images == nil {
r.EncodeNil()
} else {
yym30 := z.EncBinary()
_ = yym30
if false {
if yyq2[7] {
z.EncSendContainerState(codecSelfer_containerMapKey1234)
r.EncodeString(codecSelferC_UTF81234, string("images"))
z.EncSendContainerState(codecSelfer_containerMapValue1234)
if x.Images == nil {
r.EncodeNil()
} else {
h.encSliceContainerImage(([]ContainerImage)(x.Images), e)
yym30 := z.EncBinary()
_ = yym30
if false {
} else {
h.encSliceContainerImage(([]ContainerImage)(x.Images), e)
}
}
}
}

View File

@@ -2048,8 +2048,14 @@ type NodeSpec struct {
// DaemonEndpoint contains information about a single Daemon endpoint.
type DaemonEndpoint struct {
/*
The port tag was not properly in quotes in earlier releases, so it must be
uppercased for backwards compat (since it was falling back to var name of
'Port').
*/
// Port number of the given endpoint.
Port int32 `json:port`
Port int32 `json:"Port"`
}
// NodeDaemonEndpoints lists ports opened by daemons running on the Node.
@@ -2102,7 +2108,7 @@ type NodeStatus struct {
// More info: http://releases.k8s.io/HEAD/docs/admin/node.md#node-info
NodeInfo NodeSystemInfo `json:"nodeInfo,omitempty"`
// List of container images on this node
Images []ContainerImage `json:"images",omitempty`
Images []ContainerImage `json:"images,omitempty"`
}
// Describe a container image