chore: bump golangci-lint and fix govert issues

The latest golangci-lint spits out some govet issues.
This commit fixes them. We are also bumping the linter version.

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
This commit is contained in:
Milos Gajdos 2024-08-30 10:28:24 +01:00
parent ba2841b0ce
commit 170ac07a5e
No known key found for this signature in database
8 changed files with 17 additions and 18 deletions

View File

@ -2,7 +2,7 @@
ARG GO_VERSION=1.22.5
ARG ALPINE_VERSION=3.20
ARG GOLANGCI_LINT_VERSION=v1.59.1
ARG GOLANGCI_LINT_VERSION=v1.60.3
ARG BUILDTAGS=""
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint

View File

@ -1107,7 +1107,7 @@ func testBlobDelete(t *testing.T, env *testEnv, args blobArgs) {
ref, _ := reference.WithDigest(imageName, layerDigest)
layerURL, err := env.builder.BuildBlobURL(ref)
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
// ---------------
// Delete a layer

View File

@ -444,7 +444,7 @@ func testProxyStoreServe(t *testing.T, te *testEnv, numClients int) {
err = te.store.ServeBlob(te.ctx, w, r, remoteBlob.Digest)
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
return
}
@ -452,7 +452,7 @@ func testProxyStoreServe(t *testing.T, te *testEnv, numClients int) {
bodyBytes, err := io.ReadAll(resp.Body)
resp.Body.Close()
if err != nil {
t.Errorf(err.Error())
t.Error(err.Error())
return
}
localDigest := digest.FromBytes(bodyBytes)
@ -513,7 +513,7 @@ func testProxyStoreServe(t *testing.T, te *testEnv, numClients int) {
err = te.store.ServeBlob(te.ctx, w, r, dr.Digest)
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
dl := digest.FromBytes(w.Body.Bytes())

View File

@ -108,7 +108,7 @@ func newManifestStoreTestEnv(t *testing.T, name, tag string) *manifestStoreTestE
manifestDigest, err := populateRepo(ctx, t, truthRepo, name, tag)
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
localRegistry, err := storage.NewRegistry(ctx, inmemory.New(),

View File

@ -175,7 +175,7 @@ func TestStopRestore(t *testing.T) {
err := s.Start()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
s.add(ref1, 300*timeUnit, entryTypeBlob)
s.add(ref2, 100*timeUnit, entryTypeBlob)
@ -184,7 +184,7 @@ func TestStopRestore(t *testing.T) {
// state will be written to fs
err = s.Stop()
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
time.Sleep(10 * time.Millisecond)

View File

@ -508,7 +508,7 @@ func TestDelete(t *testing.T) {
}
if len(issues) > 0 {
t.Fatalf(strings.Join(issues, "; \n\t"))
t.Fatal(strings.Join(issues, "; \n\t"))
}
})
}
@ -746,7 +746,7 @@ func TestWalk(t *testing.T) {
t.Fatalf("expected err")
}
if !tc.err && err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
compareWalked(t, tc.expected, walked)
})

View File

@ -3,7 +3,6 @@ package driver
import (
"context"
"errors"
"fmt"
"testing"
)
@ -73,10 +72,10 @@ func TestWalkFileRemoved(t *testing.T) {
return nil
})
if len(infos) != 1 || infos[0].Path() != "zoidberg" {
t.Errorf(fmt.Sprintf("unexpected path set during walk: %s", infos))
t.Errorf("unexpected path set during walk: %s", infos)
}
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
}
@ -307,7 +306,7 @@ func TestWalkFallback(t *testing.T) {
t.Fatalf("expected err")
}
if !tc.err && err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
compareWalked(t, tc.expected, walked)
})

View File

@ -114,16 +114,16 @@ func TestPurgeOnlyUploads(t *testing.T) {
// these files aren't deleted.
dataPath, err := pathFor(uploadDataPathSpec{name: "test-repo", id: uuid.NewString()})
if err != nil {
t.Fatalf(err.Error())
t.Fatal(err.Error())
}
nonUploadPath := strings.Replace(dataPath, "_upload", "_important", -1)
if strings.Contains(nonUploadPath, "_upload") {
t.Fatalf("Non-upload path not created correctly")
t.Fatal("Non-upload path not created correctly")
}
nonUploadFile := path.Join(nonUploadPath, "file")
if err = fs.PutContent(ctx, nonUploadFile, []byte("")); err != nil {
t.Fatalf("Unable to write data file")
t.Fatal("Unable to write data file")
}
deleted, errs := PurgeUploads(ctx, fs, time.Now(), true)
@ -132,7 +132,7 @@ func TestPurgeOnlyUploads(t *testing.T) {
}
for _, file := range deleted {
if !strings.Contains(file, "_upload") {
t.Errorf("Non-upload file deleted")
t.Error("Non-upload file deleted")
}
}
}