Skip to content

Commit be54326

Browse files
rvaggaarshkshah1992
authored andcommitted
chore!: bump go version to 1.21, fix staticcheck errors
1 parent ae88e7b commit be54326

File tree

5 files changed

+9
-30
lines changed

5 files changed

+9
-30
lines changed

bls_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package ffi
22

33
import (
4+
"crypto/rand"
45
"fmt"
5-
"math/rand"
66
"testing"
77
"time"
88

@@ -11,8 +11,6 @@ import (
1111
)
1212

1313
func TestDeterministicPrivateKeyGeneration(t *testing.T) {
14-
rand.Seed(time.Now().UnixNano())
15-
1614
for i := 0; i < 10000; i++ {
1715
var xs [32]byte
1816
n, err := rand.Read(xs[:])

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/filecoin-project/filecoin-ffi
22

3-
go 1.18
3+
go 1.21
44

55
require (
66
github.com/filecoin-project/go-address v1.1.0

proofs_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"bytes"
55
"crypto/rand"
66
"io"
7-
"io/ioutil"
87
"math/big"
8+
"os"
99
"testing"
1010

1111
commcid "github.com/filecoin-project/go-fil-commcid"
@@ -76,7 +76,7 @@ func TestDoesNotExhaustFileDescriptors(t *testing.T) {
7676

7777
for i := 0; i < m; i++ {
7878
// create a temporary file over which we'll compute CommP
79-
file, err := ioutil.TempFile("", "")
79+
file, err := os.CreateTemp("", "")
8080
if err != nil {
8181
panic(err)
8282
}

sector_update.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,6 @@ func toFilRegisteredUpdateProof(p abi.RegisteredUpdateProof) (cgo.RegisteredUpda
3030
}
3131
}
3232

33-
//nolint:deadcode,unused
34-
func fromFilRegisteredUpdateProof(p cgo.RegisteredUpdateProof) (abi.RegisteredUpdateProof, error) {
35-
switch p {
36-
case cgo.RegisteredUpdateProofStackedDrg2KiBV1:
37-
return abi.RegisteredUpdateProof_StackedDrg2KiBV1, nil
38-
case cgo.RegisteredUpdateProofStackedDrg8MiBV1:
39-
return abi.RegisteredUpdateProof_StackedDrg8MiBV1, nil
40-
case cgo.RegisteredUpdateProofStackedDrg512MiBV1:
41-
return abi.RegisteredUpdateProof_StackedDrg512MiBV1, nil
42-
case cgo.RegisteredUpdateProofStackedDrg32GiBV1:
43-
return abi.RegisteredUpdateProof_StackedDrg32GiBV1, nil
44-
case cgo.RegisteredUpdateProofStackedDrg64GiBV1:
45-
return abi.RegisteredUpdateProof_StackedDrg64GiBV1, nil
46-
default:
47-
return 0, errors.Errorf("no mapping to abi.RegisteredUpdateProof value available for: %v", p)
48-
}
49-
}
50-
5133
type FunctionsSectorUpdate struct{}
5234

5335
var SectorUpdate = FunctionsSectorUpdate{}

workflows.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"encoding/binary"
1010
"fmt"
1111
"io"
12-
"io/ioutil"
1312
"math"
1413
"math/big"
1514
"os"
@@ -161,7 +160,7 @@ func WorkflowProofsLifecycle(t TestHelper) {
161160
t.RequireNoError(Unseal(sealProofType, sectorCacheDirPath, sealedSectorFile, unsealOutputFileA, sectorNum, minerID, ticket, unsealedCID))
162161
_, err = unsealOutputFileA.Seek(0, 0)
163162
t.RequireNoError(err)
164-
contents, err := ioutil.ReadFile(unsealOutputFileA.Name())
163+
contents, err := os.ReadFile(unsealOutputFileA.Name())
165164
t.RequireNoError(err)
166165

167166
// unsealed sector includes a bunch of alignment NUL-bytes
@@ -179,7 +178,7 @@ func WorkflowProofsLifecycle(t TestHelper) {
179178
t.RequireNoError(err)
180179
_, err = unsealOutputFileB.Seek(0, 0)
181180
t.RequireNoError(err)
182-
contentsB, err := ioutil.ReadFile(unsealOutputFileB.Name())
181+
contentsB, err := os.ReadFile(unsealOutputFileB.Name())
183182
t.RequireNoError(err)
184183
t.AssertEqual(127, len(contentsB))
185184
t.AssertTrue(bytes.Equal(someBytes[0:127], contentsB[0:127]), "bytes aren't equal")
@@ -191,7 +190,7 @@ func WorkflowProofsLifecycle(t TestHelper) {
191190
t.RequireNoError(err)
192191
_, err = unsealOutputFileC.Seek(0, 0)
193192
t.RequireNoError(err)
194-
contentsC, err := ioutil.ReadFile(unsealOutputFileC.Name())
193+
contentsC, err := os.ReadFile(unsealOutputFileC.Name())
195194
t.RequireNoError(err)
196195
t.AssertEqual(1016, len(contentsC))
197196
t.AssertTrue(bytes.Equal(someBytes[0:1016], contentsC[0:1016]), "bytes aren't equal")
@@ -369,7 +368,7 @@ func randUInt64() uint64 {
369368
}
370369

371370
func requireTempFile(t TestHelper, fileContentsReader io.Reader, size uint64) *os.File {
372-
file, err := ioutil.TempFile("", "")
371+
file, err := os.CreateTemp("", "")
373372
t.RequireNoError(err)
374373

375374
written, err := io.Copy(file, fileContentsReader)
@@ -387,7 +386,7 @@ func requireTempFile(t TestHelper, fileContentsReader io.Reader, size uint64) *o
387386
}
388387

389388
func requireTempDirPath(t TestHelper, prefix string) string {
390-
dir, err := ioutil.TempDir("", prefix)
389+
dir, err := os.MkdirTemp("", prefix)
391390
t.RequireNoError(err)
392391

393392
return dir

0 commit comments

Comments
 (0)