Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump golangci-lint to v1.57 #357

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ executors:
- image: node:20-slim
golangci-lint:
docker:
- image: golangci/golangci-lint:v1.56
- image: golangci/golangci-lint:v1.57
golang-previous:
docker:
- image: golang:1.21
Expand Down
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ linters:
- bodyclose
- containedctx
- contextcheck
- copyloopvar
dtrudg marked this conversation as resolved.
Show resolved Hide resolved
- decorder
- dogsled
- dupl
Expand All @@ -31,6 +32,7 @@ linters:
- grouper
- ineffassign
- interfacebloat
- intrange
- ireturn
- lll
- maintidx
Expand Down
4 changes: 1 addition & 3 deletions internal/app/siftool/info_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021-2023, Sylabs Inc. All rights reserved.
// Copyright (c) 2021-2024, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE file distributed with the sources of this project regarding your
// rights to use or distribute this software.
Expand Down Expand Up @@ -66,8 +66,6 @@ func Test_readableSize(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
if got, want := readableSize(tt.size), tt.want; got != want {
t.Errorf("got %v, want %v", got, want)
Expand Down
4 changes: 1 addition & 3 deletions pkg/integrity/clearsign_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2023, Sylabs Inc. All rights reserved.
// Copyright (c) 2020-2024, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the LICENSE.md file
// distributed with the sources of this project regarding your rights to use or distribute this
// software.
Expand Down Expand Up @@ -51,7 +51,6 @@ func Test_clearsignEncoder_signMessage(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
b := bytes.Buffer{}

Expand Down Expand Up @@ -170,7 +169,6 @@ func Test_clearsignDecoder_verifyMessage(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
b := bytes.Buffer{}

Expand Down
5 changes: 1 addition & 4 deletions pkg/integrity/digest_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2022, Sylabs Inc. All rights reserved.
// Copyright (c) 2020-2024, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the LICENSE.md file
// distributed with the sources of this project regarding your rights to use or distribute this
// software.
Expand Down Expand Up @@ -90,7 +90,6 @@ func TestNewLegacyDigest(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
d, err := newLegacyDigest(tt.ht, []byte(tt.text))
if got, want := err, tt.wantError; !errors.Is(got, want) {
Expand Down Expand Up @@ -156,7 +155,6 @@ func TestDigest_MarshalJSON(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
value, err := hex.DecodeString(tt.value)
if err != nil {
Expand Down Expand Up @@ -261,7 +259,6 @@ func TestDigest_UnmarshalJSON(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
var d digest

Expand Down
4 changes: 1 addition & 3 deletions pkg/integrity/dsse_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022-2023, Sylabs Inc. All rights reserved.
// Copyright (c) 2022-2024, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the LICENSE.md file
// distributed with the sources of this project regarding your rights to use or distribute this
// software.
Expand Down Expand Up @@ -78,7 +78,6 @@ func Test_dsseEncoder_signMessage(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
b := bytes.Buffer{}

Expand Down Expand Up @@ -319,7 +318,6 @@ func Test_dsseDecoder_verifyMessage(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
b := bytes.Buffer{}

Expand Down
5 changes: 1 addition & 4 deletions pkg/integrity/metadata_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020-2022, Sylabs Inc. All rights reserved.
// Copyright (c) 2020-2024, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the LICENSE.md file
// distributed with the sources of this project regarding your rights to use or distribute this
// software.
Expand Down Expand Up @@ -46,7 +46,6 @@ func TestGetHeaderMetadata(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
md, err := getHeaderMetadata(tt.header, tt.hash)
if got, want := err, tt.wantErr; !errors.Is(got, want) {
Expand Down Expand Up @@ -102,7 +101,6 @@ func TestGetObjectMetadata(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
md, err := getObjectMetadata(tt.relativeID, tt.descr, tt.data, tt.hash)
if got, want := err, tt.wantErr; !errors.Is(got, want) {
Expand Down Expand Up @@ -155,7 +153,6 @@ func TestGetImageMetadata(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
md, err := getImageMetadata(f, tt.minID, tt.ods, tt.hash)
if got, want := err, tt.wantErr; !errors.Is(got, want) {
Expand Down
6 changes: 0 additions & 6 deletions pkg/integrity/sign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func TestOptSignGroupObjects(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
gs := groupSigner{f: twoGroupImage, id: tt.groupID}

Expand Down Expand Up @@ -195,7 +194,6 @@ func TestNewGroupSigner(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
en := newClearsignEncoder(getTestEntity(t), fixedTime)

Expand Down Expand Up @@ -339,7 +337,6 @@ func TestGroupSigner_Sign(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
di, err := tt.gs.sign(context.Background())
if (err != nil) != tt.wantErr {
Expand Down Expand Up @@ -534,7 +531,6 @@ func TestNewSigner(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
s, err := NewSigner(tt.fi, tt.opts...)
if got, want := err, tt.wantErr; !errors.Is(got, want) {
Expand Down Expand Up @@ -827,8 +823,6 @@ func TestSigner_Sign(t *testing.T) {
}

for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
b, err := os.ReadFile(filepath.Join(corpus, tt.inputFile))
if err != nil {
Expand Down
10 changes: 0 additions & 10 deletions pkg/integrity/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func TestGroupVerifier_signatures(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
v := &groupVerifier{
f: tt.f,
Expand Down Expand Up @@ -144,7 +143,6 @@ func TestGroupVerifier_verify(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
ods := make([]sif.Descriptor, len(tt.objectIDs))
for i, id := range tt.objectIDs {
Expand Down Expand Up @@ -211,7 +209,6 @@ func TestLegacyGroupVerifier_signatures(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
v := &legacyGroupVerifier{
f: tt.f,
Expand Down Expand Up @@ -279,7 +276,6 @@ func TestLegacyGroupVerifier_verify(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
ods, err := getGroupObjects(tt.f, tt.groupID)
if err != nil {
Expand Down Expand Up @@ -344,7 +340,6 @@ func TestLegacyObjectVerifier_signatures(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
od, err := tt.f.GetDescriptor(sif.WithID(tt.id))
if err != nil {
Expand Down Expand Up @@ -420,7 +415,6 @@ func TestLegacyObjectVerifier_verify(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
od, err := tt.f.GetDescriptor(sif.WithID(tt.id))
if err != nil {
Expand Down Expand Up @@ -677,7 +671,6 @@ func TestNewVerifier(t *testing.T) { //nolint:maintidx
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
v, err := NewVerifier(tt.fi, tt.opts...)
if got, want := err, tt.wantErr; !errors.Is(got, want) {
Expand Down Expand Up @@ -845,7 +838,6 @@ func TestVerifier_AnySignedBy(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
v := Verifier{tasks: tt.tasks}

Expand Down Expand Up @@ -941,7 +933,6 @@ func TestVerifier_AllSignedBy(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
v := Verifier{tasks: tt.tasks}

Expand Down Expand Up @@ -1097,7 +1088,6 @@ func TestVerifier_Verify(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
var vr VerifyResult

Expand Down
3 changes: 1 addition & 2 deletions pkg/sif/descriptor_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018-2023, Sylabs Inc. All rights reserved.
// Copyright (c) 2018-2024, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE file distributed with the sources of this project regarding your
// rights to use or distribute this software.
Expand Down Expand Up @@ -521,7 +521,6 @@ func TestDescriptor_GetIntegrityReader(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
d := Descriptor{
raw: rd,
Expand Down
6 changes: 1 addition & 5 deletions pkg/sif/load_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018-2021, Sylabs Inc. All rights reserved.
// Copyright (c) 2018-2024, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE file distributed with the sources of this project regarding your
// rights to use or distribute this software.
Expand Down Expand Up @@ -33,8 +33,6 @@ func TestLoadContainerFromPath(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
f, err := LoadContainerFromPath(tt.path, tt.opts...)
if err != nil {
Expand Down Expand Up @@ -66,8 +64,6 @@ func TestLoadContainer(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt

t.Run(tt.name, func(t *testing.T) {
rw, err := os.Open(filepath.Join(corpus, "one-group.sif"))
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions pkg/sif/sif_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021, Sylabs Inc. All rights reserved.
// Copyright (c) 2021-2024, Sylabs Inc. All rights reserved.
// This software is licensed under a 3-clause BSD license. Please consult the
// LICENSE file distributed with the sources of this project regarding your
// rights to use or distribute this software.
Expand Down Expand Up @@ -86,7 +86,6 @@ func TestHeader_GetIntegrityReader(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
b := bytes.Buffer{}

Expand Down