Correcting all go vet errors
This commit is contained in:
@@ -79,7 +79,7 @@ func (endpointsStrategy) AllowUnconditionalUpdate() bool {
|
||||
|
||||
// MatchEndpoints returns a generic matcher for a given label and field selector.
|
||||
func MatchEndpoints(label labels.Selector, field fields.Selector) generic.Matcher {
|
||||
return &generic.SelectionPredicate{label, field, EndpointsAttributes}
|
||||
return &generic.SelectionPredicate{Label: label, Field: field, GetAttrs: EndpointsAttributes}
|
||||
}
|
||||
|
||||
// EndpointsAttributes returns the attributes of an endpoint such that a
|
||||
|
@@ -137,13 +137,13 @@ func (rs *REST) getAttrs(obj runtime.Object) (objLabels labels.Set, objFields fi
|
||||
}
|
||||
|
||||
func (rs *REST) List(ctx api.Context, label labels.Selector, field fields.Selector) (runtime.Object, error) {
|
||||
return rs.registry.ListPredicate(ctx, &generic.SelectionPredicate{label, field, rs.getAttrs})
|
||||
return rs.registry.ListPredicate(ctx, &generic.SelectionPredicate{Label: label, Field: field, GetAttrs: rs.getAttrs})
|
||||
}
|
||||
|
||||
// Watch returns Events events via a watch.Interface.
|
||||
// It implements rest.Watcher.
|
||||
func (rs *REST) Watch(ctx api.Context, label labels.Selector, field fields.Selector, resourceVersion string) (watch.Interface, error) {
|
||||
return rs.registry.WatchPredicate(ctx, &generic.SelectionPredicate{label, field, rs.getAttrs}, resourceVersion)
|
||||
return rs.registry.WatchPredicate(ctx, &generic.SelectionPredicate{Label: label, Field: field, GetAttrs: rs.getAttrs}, resourceVersion)
|
||||
}
|
||||
|
||||
// New returns a new api.Event
|
||||
|
@@ -69,7 +69,7 @@ func (limitrangeStrategy) AllowUnconditionalUpdate() bool {
|
||||
}
|
||||
|
||||
func MatchLimitRange(label labels.Selector, field fields.Selector) generic.Matcher {
|
||||
return &generic.SelectionPredicate{label, field, getAttrs}
|
||||
return &generic.SelectionPredicate{Label: label, Field: field, GetAttrs: getAttrs}
|
||||
}
|
||||
|
||||
func getAttrs(obj runtime.Object) (objLabels labels.Set, objFields fields.Set, err error) {
|
||||
|
@@ -38,7 +38,7 @@ func TestMatchNode(t *testing.T) {
|
||||
m := MatchNode(labels.Everything(), field.AsSelector())
|
||||
_, matchesSingle := m.MatchesSingle()
|
||||
if e, a := expectedResult, matchesSingle; e != a {
|
||||
t.Errorf("%+v: expected %v, got %v", e, a)
|
||||
t.Errorf("%+v: expected %v, got %v", fieldSet, e, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -124,7 +124,7 @@ func (c *Repair) RunOnce() error {
|
||||
util.HandleError(fmt.Errorf("the cluster IP %s for service %s/%s is not within the service CIDR %s; please recreate", ip, svc.Name, svc.Namespace, c.network))
|
||||
case ipallocator.ErrFull:
|
||||
// TODO: send event
|
||||
return fmt.Errorf("the service CIDR %s is full; you must widen the CIDR in order to create new services")
|
||||
return fmt.Errorf("the service CIDR %v is full; you must widen the CIDR in order to create new services", r)
|
||||
default:
|
||||
return fmt.Errorf("unable to allocate cluster IP %s for service %s/%s due to an unknown error, exiting: %v", ip, svc.Name, svc.Namespace, err)
|
||||
}
|
||||
|
@@ -19,9 +19,10 @@ package portallocator
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"strconv"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/util"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func TestAllocate(t *testing.T) {
|
||||
@@ -42,10 +43,10 @@ func TestAllocate(t *testing.T) {
|
||||
}
|
||||
count++
|
||||
if !pr.Contains(p) {
|
||||
t.Fatalf("allocated %s which is outside of %s", p, pr)
|
||||
t.Fatalf("allocated %d which is outside of %v", p, pr)
|
||||
}
|
||||
if found.Has(strconv.Itoa(p)) {
|
||||
t.Fatalf("allocated %s twice @ %d", p, count)
|
||||
t.Fatalf("allocated %d twice @ %d", p, count)
|
||||
}
|
||||
found.Insert(strconv.Itoa(p))
|
||||
}
|
||||
@@ -65,7 +66,7 @@ func TestAllocate(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if released != p {
|
||||
t.Errorf("unexpected %s : %s", p, released)
|
||||
t.Errorf("unexpected %d : %d", p, released)
|
||||
}
|
||||
|
||||
if err := r.Release(released); err != nil {
|
||||
@@ -139,7 +140,7 @@ func TestSnapshot(t *testing.T) {
|
||||
|
||||
for _, n := range ports {
|
||||
if !other.Has(n) {
|
||||
t.Errorf("restored range does not have %s", n)
|
||||
t.Errorf("restored range does not have %d", n)
|
||||
}
|
||||
}
|
||||
if other.Free() != r.Free() {
|
||||
|
Reference in New Issue
Block a user