Skip to content

Commit

Permalink
registry/client: use struct literals
Browse files Browse the repository at this point in the history
Remove some intermediate variables, and use struct literals instead.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 1d8cd5e)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Jan 6, 2024
1 parent 1be402c commit bb33a43
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions registry/client/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,14 @@ func NewRepository(name reference.Named, baseURL string, transport http.RoundTri
return nil, err
}

client := &http.Client{
Transport: transport,
CheckRedirect: checkHTTPRedirect,
// TODO(dmcgowan): create cookie jar
}

return &repository{
client: client,
ub: ub,
name: name,
client: &http.Client{
Transport: transport,
CheckRedirect: checkHTTPRedirect,
// TODO(dmcgowan): create cookie jar
},
ub: ub,
name: name,
}, nil
}

Expand All @@ -159,16 +157,15 @@ func (r *repository) Named() reference.Named {
}

func (r *repository) Blobs(ctx context.Context) distribution.BlobStore {
statter := &blobStatter{
return &blobs{
name: r.name,
ub: r.ub,
client: r.client,
}
return &blobs{
name: r.name,
ub: r.ub,
client: r.client,
statter: cache.NewCachedBlobStatter(memory.NewInMemoryBlobDescriptorCacheProvider(), statter),
statter: cache.NewCachedBlobStatter(memory.NewInMemoryBlobDescriptorCacheProvider(), &blobStatter{
name: r.name,
ub: r.ub,
client: r.client,
}),
}
}

Expand Down

0 comments on commit bb33a43

Please sign in to comment.