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 go version to 1.21, fix staticcheck errors #477

Merged
merged 1 commit into from
Jul 29, 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
4 changes: 1 addition & 3 deletions bls_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package ffi

import (
"crypto/rand"
"fmt"
"math/rand"
"testing"
"time"

Expand All @@ -11,8 +11,6 @@ import (
)

func TestDeterministicPrivateKeyGeneration(t *testing.T) {
rand.Seed(time.Now().UnixNano())

for i := 0; i < 10000; i++ {
var xs [32]byte
n, err := rand.Read(xs[:])
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/filecoin-project/filecoin-ffi

go 1.18
go 1.21

require (
github.com/filecoin-project/go-address v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions proofs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"bytes"
"crypto/rand"
"io"
"io/ioutil"
"math/big"
"os"
"testing"

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

for i := 0; i < m; i++ {
// create a temporary file over which we'll compute CommP
file, err := ioutil.TempFile("", "")
file, err := os.CreateTemp("", "")
if err != nil {
panic(err)
}
Expand Down
18 changes: 0 additions & 18 deletions sector_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,6 @@ func toFilRegisteredUpdateProof(p abi.RegisteredUpdateProof) (cgo.RegisteredUpda
}
}

//nolint:deadcode,unused
func fromFilRegisteredUpdateProof(p cgo.RegisteredUpdateProof) (abi.RegisteredUpdateProof, error) {
switch p {
case cgo.RegisteredUpdateProofStackedDrg2KiBV1:
return abi.RegisteredUpdateProof_StackedDrg2KiBV1, nil
case cgo.RegisteredUpdateProofStackedDrg8MiBV1:
return abi.RegisteredUpdateProof_StackedDrg8MiBV1, nil
case cgo.RegisteredUpdateProofStackedDrg512MiBV1:
return abi.RegisteredUpdateProof_StackedDrg512MiBV1, nil
case cgo.RegisteredUpdateProofStackedDrg32GiBV1:
return abi.RegisteredUpdateProof_StackedDrg32GiBV1, nil
case cgo.RegisteredUpdateProofStackedDrg64GiBV1:
return abi.RegisteredUpdateProof_StackedDrg64GiBV1, nil
default:
return 0, errors.Errorf("no mapping to abi.RegisteredUpdateProof value available for: %v", p)
}
}

type FunctionsSectorUpdate struct{}

var SectorUpdate = FunctionsSectorUpdate{}
Expand Down
11 changes: 5 additions & 6 deletions workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"encoding/binary"
"fmt"
"io"
"io/ioutil"
"math"
"math/big"
"os"
Expand Down Expand Up @@ -161,7 +160,7 @@ func WorkflowProofsLifecycle(t TestHelper) {
t.RequireNoError(Unseal(sealProofType, sectorCacheDirPath, sealedSectorFile, unsealOutputFileA, sectorNum, minerID, ticket, unsealedCID))
_, err = unsealOutputFileA.Seek(0, 0)
t.RequireNoError(err)
contents, err := ioutil.ReadFile(unsealOutputFileA.Name())
contents, err := os.ReadFile(unsealOutputFileA.Name())
t.RequireNoError(err)

// unsealed sector includes a bunch of alignment NUL-bytes
Expand All @@ -179,7 +178,7 @@ func WorkflowProofsLifecycle(t TestHelper) {
t.RequireNoError(err)
_, err = unsealOutputFileB.Seek(0, 0)
t.RequireNoError(err)
contentsB, err := ioutil.ReadFile(unsealOutputFileB.Name())
contentsB, err := os.ReadFile(unsealOutputFileB.Name())
t.RequireNoError(err)
t.AssertEqual(127, len(contentsB))
t.AssertTrue(bytes.Equal(someBytes[0:127], contentsB[0:127]), "bytes aren't equal")
Expand All @@ -191,7 +190,7 @@ func WorkflowProofsLifecycle(t TestHelper) {
t.RequireNoError(err)
_, err = unsealOutputFileC.Seek(0, 0)
t.RequireNoError(err)
contentsC, err := ioutil.ReadFile(unsealOutputFileC.Name())
contentsC, err := os.ReadFile(unsealOutputFileC.Name())
t.RequireNoError(err)
t.AssertEqual(1016, len(contentsC))
t.AssertTrue(bytes.Equal(someBytes[0:1016], contentsC[0:1016]), "bytes aren't equal")
Expand Down Expand Up @@ -369,7 +368,7 @@ func randUInt64() uint64 {
}

func requireTempFile(t TestHelper, fileContentsReader io.Reader, size uint64) *os.File {
file, err := ioutil.TempFile("", "")
file, err := os.CreateTemp("", "")
t.RequireNoError(err)

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

func requireTempDirPath(t TestHelper, prefix string) string {
dir, err := ioutil.TempDir("", prefix)
dir, err := os.MkdirTemp("", prefix)
t.RequireNoError(err)

return dir
Expand Down
Loading