Skip to content

Commit 370e8a5

Browse files
authored
Fix a few lint issues (#1684)
1 parent 3120ba5 commit 370e8a5

File tree

12 files changed

+15
-24
lines changed

12 files changed

+15
-24
lines changed

cmd/crane/cmd/catalog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
)
2727

2828
// NewCmdCatalog creates a new cobra.Command for the catalog subcommand.
29-
func NewCmdCatalog(options *[]crane.Option, argv ...string) *cobra.Command {
29+
func NewCmdCatalog(options *[]crane.Option, _ ...string) *cobra.Command {
3030
var fullRef bool
3131
cmd := &cobra.Command{
3232
Use: "catalog REGISTRY",

pkg/authn/keychain_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ type fakeKeychain struct {
399399
count int
400400
}
401401

402-
func (k *fakeKeychain) Resolve(target Resource) (Authenticator, error) {
402+
func (k *fakeKeychain) Resolve(_ Resource) (Authenticator, error) {
403403
k.count++
404404
return k.auth, k.err
405405
}

pkg/crane/push.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525

2626
// Load reads the tarball at path as a v1.Image.
2727
func Load(path string, opt ...Option) (v1.Image, error) {
28-
return LoadTag(path, "")
28+
return LoadTag(path, "", opt...)
2929
}
3030

3131
// LoadTag reads a tag from the tarball at path as a v1.Image.

pkg/legacy/tarball/write.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,7 @@ func MultiWrite(refToImage map[name.Reference]v1.Image, w io.Writer) error {
313313
if err != nil {
314314
return err
315315
}
316-
if err := writeTarEntry(tf, "repositories", bytes.NewReader(reposBytes), int64(len(reposBytes))); err != nil {
317-
return err
318-
}
319-
return nil
316+
return writeTarEntry(tf, "repositories", bytes.NewReader(reposBytes), int64(len(reposBytes)))
320317
}
321318

322319
func dedupRefToImage(refToImage map[name.Reference]v1.Image) ([]v1.Image, map[v1.Image][]string) {

pkg/v1/daemon/image_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type MockClient struct {
4949
saveBody io.ReadCloser
5050
}
5151

52-
func (m *MockClient) NegotiateAPIVersion(ctx context.Context) {
52+
func (m *MockClient) NegotiateAPIVersion(_ context.Context) {
5353
m.negotiated = true
5454
}
5555

pkg/v1/daemon/write_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type errReader struct {
3333
err error
3434
}
3535

36-
func (r *errReader) Read(p []byte) (int, error) {
36+
func (r *errReader) Read(_ []byte) (int, error) {
3737
return 0, r.err
3838
}
3939

@@ -51,7 +51,7 @@ func (m *MockClient) ImageLoad(ctx context.Context, r io.Reader, _ bool) (types.
5151
}, m.loadErr
5252
}
5353

54-
func (m *MockClient) ImageTag(ctx context.Context, source, target string) error {
54+
func (m *MockClient) ImageTag(ctx context.Context, _, _ string) error {
5555
if !m.negotiated {
5656
return errors.New("you forgot to call NegotiateAPIVersion before calling ImageTag")
5757
}

pkg/v1/google/list_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ type recorder struct {
169169
Errs []error
170170
}
171171

172-
func (r *recorder) walk(repo name.Repository, tags *Tags, err error) error {
172+
func (r *recorder) walk(_ name.Repository, tags *Tags, err error) error {
173173
r.Tags = append(r.Tags, tags)
174174
r.Errs = append(r.Errs, err)
175175

pkg/v1/remote/transport/error_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ type errReadCloser struct {
227227
err error
228228
}
229229

230-
func (e *errReadCloser) Read(p []byte) (int, error) {
230+
func (e *errReadCloser) Read(_ []byte) (int, error) {
231231
return 0, e.err
232232
}
233233

pkg/v1/remote/transport/retry_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type mockTransport struct {
3333
count int
3434
}
3535

36-
func (t *mockTransport) RoundTrip(in *http.Request) (out *http.Response, err error) {
36+
func (t *mockTransport) RoundTrip(_ *http.Request) (out *http.Response, err error) {
3737
defer func() { t.count++ }()
3838
if t.count < len(t.resps) {
3939
out = t.resps[t.count]

pkg/v1/remote/write.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,7 @@ func (w *writer) commitSubjectReferrers(ctx context.Context, sub name.Digest, ad
531531
return im.Manifests[i].Digest.String() < im.Manifests[j].Digest.String()
532532
})
533533
logs.Progress.Printf("updating fallback tag %s with new referrer", t.Identifier())
534-
if err := w.commitManifest(ctx, fallbackTaggable{im}, t); err != nil {
535-
return err
536-
}
537-
return nil
534+
return w.commitManifest(ctx, fallbackTaggable{im}, t)
538535
}
539536

540537
type fallbackTaggable struct {

0 commit comments

Comments
 (0)