@@ -216,7 +216,7 @@ func continueOnError(err error) bool {
216216}
217217
218218func (c * client ) iterateEndpoints (ctx context.Context , namedRef reference.Named , each func (context.Context , distribution.Repository , reference.Named ) (bool , error )) error {
219- endpoints , err := allEndpoints (namedRef , c .insecureRegistry )
219+ endpoints , err := allEndpoints (ctx , namedRef , c .insecureRegistry )
220220 if err != nil {
221221 return err
222222 }
@@ -271,11 +271,11 @@ 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).
278- func allEndpoints (namedRef reference.Named , insecure bool ) ([]registry.APIEndpoint , error ) {
278+ func allEndpoints (ctx context. Context , namedRef reference.Named , insecure bool ) ([]registry.APIEndpoint , error ) {
279279 var serviceOpts registry.ServiceOptions
280280 if insecure {
281281 logrus .Debugf ("allowing insecure registry for: %s" , reference .Domain (namedRef ))
@@ -285,22 +285,11 @@ func allEndpoints(namedRef reference.Named, insecure bool) ([]registry.APIEndpoi
285285 if err != nil {
286286 return nil , err
287287 }
288- endpoints , err := registryService .Endpoints (context . TODO () , reference .Domain (namedRef ))
288+ endpoints , err := registryService .Endpoints (ctx , reference .Domain (namedRef ))
289289 logrus .Debugf ("endpoints for %s: %v" , namedRef , endpoints )
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
306295func (notFoundError ) NotFound () {}
0 commit comments