Skip to content

Commit c7fdfb0

Browse files
Stebalienvyzo
authored andcommitted
ci: fix linting
1 parent baef8c0 commit c7fdfb0

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

.golangci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ skip-dirs:
2525

2626
issues:
2727
exclude:
28-
- "func name will be used as test\\.Test.* by other packages, and that stutters; consider calling this"
28+
- "by other packages, and that stutters; consider calling this"
2929
- "Potential file inclusion via variable"
3030
- "should have( a package)? comment"
3131
- "Error return value of `logging.SetLogLevel` is not checked"
@@ -37,6 +37,8 @@ issues:
3737
- "string .* has .* occurrences, make it a constant"
3838
- "a blank import should be only in a main or test package, or have a comment justifying it"
3939
- "package comment should be of the form"
40+
- "Potential hardcoded credentials"
41+
- "Use of weak random number generator"
4042

4143
exclude-use-default: false
4244
exclude-rules:

extern/sector-storage/ffiwrapper/sealer_test.go

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,21 @@ func (s *seal) precommit(t *testing.T, sb *Sealer, id storage.SectorRef, done fu
7171
r := data(id.ID.Number, dlen)
7272
s.pi, err = sb.AddPiece(context.TODO(), id, []abi.UnpaddedPieceSize{}, dlen, r)
7373
if err != nil {
74-
t.Fatalf("%+v", err)
74+
t.Errorf("%+v", err)
75+
return
7576
}
7677

7778
s.ticket = sealRand
7879

7980
p1, err := sb.SealPreCommit1(context.TODO(), id, s.ticket, []abi.PieceInfo{s.pi})
8081
if err != nil {
81-
t.Fatalf("%+v", err)
82+
t.Errorf("%+v", err)
83+
return
8284
}
8385
cids, err := sb.SealPreCommit2(context.TODO(), id, p1)
8486
if err != nil {
85-
t.Fatalf("%+v", err)
87+
t.Errorf("%+v", err)
88+
return
8689
}
8790
s.cids = cids
8891
}
@@ -94,11 +97,13 @@ func (s *seal) commit(t *testing.T, sb *Sealer, done func()) storage.Proof {
9497

9598
pc1, err := sb.SealCommit1(context.TODO(), s.ref, s.ticket, seed, []abi.PieceInfo{s.pi}, s.cids)
9699
if err != nil {
97-
t.Fatalf("%+v", err)
100+
t.Errorf("%+v", err)
101+
return nil
98102
}
99103
proof, err := sb.SealCommit2(context.TODO(), s.ref, pc1)
100104
if err != nil {
101-
t.Fatalf("%+v", err)
105+
t.Errorf("%+v", err)
106+
return nil
102107
}
103108

104109
ok, err := ProofVerifier.VerifySeal(proof2.SealVerifyInfo{
@@ -111,11 +116,13 @@ func (s *seal) commit(t *testing.T, sb *Sealer, done func()) storage.Proof {
111116
UnsealedCID: s.cids.Unsealed,
112117
})
113118
if err != nil {
114-
t.Fatalf("%+v", err)
119+
t.Errorf("%+v", err)
120+
return nil
115121
}
116122

117123
if !ok {
118-
t.Fatal("proof failed to validate")
124+
t.Errorf("proof failed to validate")
125+
return nil
119126
}
120127

121128
return proof
@@ -458,17 +465,17 @@ func TestSealAndVerify3(t *testing.T) {
458465
s3 := seal{ref: si3}
459466

460467
wg.Add(3)
461-
go s1.precommit(t, sb, si1, wg.Done) //nolint: staticcheck
468+
go s1.precommit(t, sb, si1, wg.Done)
462469
time.Sleep(100 * time.Millisecond)
463-
go s2.precommit(t, sb, si2, wg.Done) //nolint: staticcheck
470+
go s2.precommit(t, sb, si2, wg.Done)
464471
time.Sleep(100 * time.Millisecond)
465-
go s3.precommit(t, sb, si3, wg.Done) //nolint: staticcheck
472+
go s3.precommit(t, sb, si3, wg.Done)
466473
wg.Wait()
467474

468475
wg.Add(3)
469-
go s1.commit(t, sb, wg.Done) //nolint: staticcheck
470-
go s2.commit(t, sb, wg.Done) //nolint: staticcheck
471-
go s3.commit(t, sb, wg.Done) //nolint: staticcheck
476+
go s1.commit(t, sb, wg.Done)
477+
go s2.commit(t, sb, wg.Done)
478+
go s3.commit(t, sb, wg.Done)
472479
wg.Wait()
473480

474481
post(t, sb, nil, s1, s2, s3)

extern/sector-storage/tarutil/systar.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ func ExtractTar(body io.Reader, dir string, buf []byte) error {
3131
case nil:
3232
}
3333

34+
//nolint:gosec
3435
f, err := os.Create(filepath.Join(dir, header.Name))
3536
if err != nil {
37+
//nolint:gosec
3638
return xerrors.Errorf("creating file %s: %w", filepath.Join(dir, header.Name), err)
3739
}
3840

0 commit comments

Comments
 (0)