daemon/create.go: Supersede github.com/pkg/errors
Will make it possible to use `errors.Join()` in that file. Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
parent
89b542b421
commit
742475bc8d
1 changed files with 5 additions and 5 deletions
|
@ -2,6 +2,7 @@ package daemon // import "github.com/docker/docker/daemon"
|
|||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"runtime"
|
||||
|
@ -23,7 +24,6 @@ import (
|
|||
"github.com/docker/docker/runconfig"
|
||||
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
"github.com/opencontainers/selinux/go-selinux"
|
||||
"github.com/pkg/errors"
|
||||
archvariant "github.com/tonistiigi/go-archvariant"
|
||||
)
|
||||
|
||||
|
@ -321,23 +321,23 @@ func verifyNetworkingConfig(nwConfig *networktypes.NetworkingConfig) error {
|
|||
for k := range nwConfig.EndpointsConfig {
|
||||
l = append(l, k)
|
||||
}
|
||||
return errors.Errorf("Container cannot be connected to network endpoints: %s", strings.Join(l, ", "))
|
||||
return fmt.Errorf("Container cannot be connected to network endpoints: %s", strings.Join(l, ", "))
|
||||
}
|
||||
|
||||
for k, v := range nwConfig.EndpointsConfig {
|
||||
if v == nil {
|
||||
return errors.Errorf("no EndpointSettings for %s", k)
|
||||
return fmt.Errorf("no EndpointSettings for %s", k)
|
||||
}
|
||||
if v.IPAMConfig != nil {
|
||||
if v.IPAMConfig.IPv4Address != "" && net.ParseIP(v.IPAMConfig.IPv4Address).To4() == nil {
|
||||
return errors.Errorf("invalid IPv4 address: %s", v.IPAMConfig.IPv4Address)
|
||||
return fmt.Errorf("invalid IPv4 address: %s", v.IPAMConfig.IPv4Address)
|
||||
}
|
||||
if v.IPAMConfig.IPv6Address != "" {
|
||||
n := net.ParseIP(v.IPAMConfig.IPv6Address)
|
||||
// if the address is an invalid network address (ParseIP == nil) or if it is
|
||||
// an IPv4 address (To4() != nil), then it is an invalid IPv6 address
|
||||
if n == nil || n.To4() != nil {
|
||||
return errors.Errorf("invalid IPv6 address: %s", v.IPAMConfig.IPv6Address)
|
||||
return fmt.Errorf("invalid IPv6 address: %s", v.IPAMConfig.IPv6Address)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue