Skip to content

Commit 816f455

Browse files
committed
internal/registryclient: simplify notFoundError
- remove constructor - fix mixed pointer/non-pointer receivers - just embed the error we want to produce Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent d61519f commit 816f455

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

internal/registryclient/fetcher.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ func (c *client) iterateEndpoints(ctx context.Context, namedRef reference.Named,
271271
return nil
272272
}
273273
}
274-
return newNotFoundError(namedRef.String())
274+
return notFoundError{errors.New("no such manifest: " + namedRef.String())}
275275
}
276276

277277
// allEndpoints returns a list of endpoints ordered by priority (v2, http).
@@ -290,17 +290,6 @@ func allEndpoints(ctx context.Context, namedRef reference.Named, insecure bool)
290290
return endpoints, err
291291
}
292292

293-
func newNotFoundError(ref string) *notFoundError {
294-
return &notFoundError{err: errors.New("no such manifest: " + ref)}
295-
}
296-
297-
type notFoundError struct {
298-
err error
299-
}
300-
301-
func (n *notFoundError) Error() string {
302-
return n.err.Error()
303-
}
293+
type notFoundError struct{ error }
304294

305-
// NotFound satisfies interface github.com/docker/docker/errdefs.ErrNotFound
306295
func (notFoundError) NotFound() {}

0 commit comments

Comments
 (0)