diff --git a/api/types/container/hostconfig_test.go b/api/types/container/hostconfig_test.go index 0f6ec277f5..0d24639f2e 100644 --- a/api/types/container/hostconfig_test.go +++ b/api/types/container/hostconfig_test.go @@ -3,7 +3,6 @@ package container import ( "testing" - "github.com/docker/docker/errdefs" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" ) @@ -96,9 +95,19 @@ func TestValidateRestartPolicy(t *testing.T) { if tc.expectedErr == "" { assert.Check(t, err) } else { - assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter)) + assert.Check(t, is.ErrorType(err, isInvalidParameter)) assert.Check(t, is.Error(err, tc.expectedErr)) } }) } } + +// isInvalidParameter is a minimal implementation of [github.com/docker/docker/errdefs.IsInvalidParameter], +// because this was the only import of that package in api/types, which is the +// package imported by external users. +func isInvalidParameter(err error) bool { + _, ok := err.(interface { + InvalidParameter() + }) + return ok +} diff --git a/api/types/registry/authconfig.go b/api/types/registry/authconfig.go index 2f49428890..ebd5e4b9e2 100644 --- a/api/types/registry/authconfig.go +++ b/api/types/registry/authconfig.go @@ -3,10 +3,9 @@ import ( "context" "encoding/base64" "encoding/json" + "fmt" "io" "strings" - - "github.com/pkg/errors" ) // AuthHeader is the name of the header used to send encoded registry @@ -98,7 +97,7 @@ func decodeAuthConfigFromReader(rdr io.Reader) (*AuthConfig, error) { } func invalid(err error) error { - return errInvalidParameter{errors.Wrap(err, "invalid X-Registry-Auth header")} + return errInvalidParameter{fmt.Errorf("invalid X-Registry-Auth header: %w", err)} } type errInvalidParameter struct{ error }