1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Fix govet warnings

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
This commit is contained in:
Arnaud Porterie 2015-03-04 14:56:22 -08:00
parent 263dd22fe3
commit 2457d2549f
3 changed files with 6 additions and 6 deletions

View file

@ -36,7 +36,7 @@ func RegisterNetworkType(name string, creatorFn interface{}, creatorArg interfac
ctorArg := []reflect.Type{reflect.TypeOf((*string)(nil)), reflect.TypeOf(creatorArg)}
ctorRet := []reflect.Type{reflect.TypeOf((*Network)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}
if err := validateFunctionSignature(creatorFn, ctorArg, ctorRet); err != nil {
sig := fmt.Sprintf("func (%s) (Network, error)", ctorArg[0].Name)
sig := fmt.Sprintf("func (%s) (Network, error)", ctorArg[0].Name())
return fmt.Errorf("invalid signature for %q creator function (expected %s)", name, sig)
}
@ -81,7 +81,7 @@ func validateFunctionSignature(fn interface{}, params []reflect.Type, returns []
// Valid that argument is a function.
fnType := reflect.TypeOf(fn)
if fnType.Kind() != reflect.Func {
return fmt.Errorf("argument is %s, not function", fnType.Name)
return fmt.Errorf("argument is %s, not function", fnType.Name())
}
// Vaidate arguments numbers and types.
@ -90,7 +90,7 @@ func validateFunctionSignature(fn interface{}, params []reflect.Type, returns []
}
for i, argType := range params {
if argType != fnType.In(i) {
return fmt.Errorf("argument %d type should be %s, got %s", i, argType.Name, fnType.In(i).Name)
return fmt.Errorf("argument %d type should be %s, got %s", i, argType.Name(), fnType.In(i).Name())
}
}
@ -100,7 +100,7 @@ func validateFunctionSignature(fn interface{}, params []reflect.Type, returns []
}
for i, retType := range returns {
if retType != fnType.Out(i) {
return fmt.Errorf("return value %d type should be %s, got %s", i, retType.Name, fnType.Out(i).Name)
return fmt.Errorf("return value %d type should be %s, got %s", i, retType.Name(), fnType.Out(i).Name())
}
}

View file

@ -47,7 +47,7 @@ func setupBridgeIPv4(i *bridgeInterface) error {
}
log.Debugf("Creating bridge interface %q with network %s", i.Config.BridgeName, bridgeIPv4)
if err := netlink.AddrAdd(i.Link, &netlink.Addr{bridgeIPv4, ""}); err != nil {
if err := netlink.AddrAdd(i.Link, &netlink.Addr{IPNet: bridgeIPv4}); err != nil {
return fmt.Errorf("Failed to add IPv4 address %s to bridge: %v", bridgeIPv4, err)
}

View file

@ -29,7 +29,7 @@ func setupBridgeIPv6(i *bridgeInterface) error {
return fmt.Errorf("Unable to enable IPv6 addresses on bridge: %v", err)
}
if err := netlink.AddrAdd(i.Link, &netlink.Addr{bridgeIPv6, ""}); err != nil {
if err := netlink.AddrAdd(i.Link, &netlink.Addr{IPNet: bridgeIPv6}); err != nil {
return fmt.Errorf("Failed to add IPv6 address %s to bridge: %v", bridgeIPv6, err)
}