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/types no cgo #6362

Merged
merged 1 commit into from
Jun 20, 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
13 changes: 6 additions & 7 deletions cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
"github.com/filecoin-project/venus/pkg/consensus/chainselector"
"github.com/filecoin-project/venus/pkg/httpreader"

"github.com/DataDog/zstd"
"github.com/filecoin-project/venus/pkg/chain"
"github.com/filecoin-project/venus/pkg/repo"
"github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log/v2"
"github.com/klauspost/compress/zstd"
"github.com/mitchellh/go-homedir"
"gopkg.in/cheggaaa/pb.v1"
)
Expand Down Expand Up @@ -80,12 +80,11 @@ func importChain(ctx context.Context, r repo.Repo, fname string) error {

var ir io.Reader = br
if string(header[1:]) == "\xB5\x2F\xFD" { // zstd
zr := zstd.NewReader(br)
defer func() {
if err := zr.Close(); err != nil {
log.Errorw("closing zstd reader", "error", err)
}
}()
zr, err := zstd.NewReader(br)
if err != nil {
return err
}
defer zr.Close()
ir = zr
}

Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ go 1.21
require (
contrib.go.opencensus.io/exporter/prometheus v0.4.2
github.com/BurntSushi/toml v1.3.0
github.com/DataDog/zstd v1.4.5
github.com/Gurpartap/async v0.0.0-20180927173644-4f7f499dd9ee
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d
github.com/ahmetb/go-linq/v3 v3.2.0
Expand Down Expand Up @@ -244,7 +243,7 @@ require (
github.com/jpillora/backoff v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kilic/bls12-381 v0.1.0 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/klauspost/compress v1.17.8
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym
github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=
github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM=
github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/Gurpartap/async v0.0.0-20180927173644-4f7f499dd9ee h1:8doiS7ib3zi6/K172oDhSKU0dJ/miJramo9NITOMyZQ=
github.com/Gurpartap/async v0.0.0-20180927173644-4f7f499dd9ee/go.mod h1:W0GbEAA4uFNYOGG2cJpmFJ04E6SD1NLELPYZB57/7AY=
github.com/Kubuxu/go-os-helper v0.0.1 h1:EJiD2VUQyh5A9hWJLmc6iWg6yIcJ7jpBcwC8GMGXfDk=
Expand Down
1 change: 0 additions & 1 deletion venus-devtool/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ require (
contrib.go.opencensus.io/exporter/graphite v0.0.0-20200424223504-26b90655e0ce // indirect
contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect
github.com/BurntSushi/toml v1.3.0 // indirect
github.com/DataDog/zstd v1.4.5 // indirect
github.com/GeertJohan/go.incremental v1.0.0 // indirect
github.com/GeertJohan/go.rice v1.0.3 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
Expand Down
2 changes: 0 additions & 2 deletions venus-devtool/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ github.com/BurntSushi/toml v1.3.0 h1:Ws8e5YmnrGEHzZEzg0YvK/7COGYtTC5PbaH9oSSbgfA
github.com/BurntSushi/toml v1.3.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/DataDog/zstd v1.4.1/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ=
github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo=
github.com/GeertJohan/go.incremental v1.0.0 h1:7AH+pY1XUgQE4Y1HcXYaMqAI0m9yrFqo/jt0CW30vsg=
github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0=
github.com/GeertJohan/go.rice v1.0.3 h1:k5viR+xGtIhF61125vCE1cmJ5957RQGXG6dmbaWZSmI=
Expand Down
16 changes: 11 additions & 5 deletions venus-shared/actors/builtin_actors.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
"strconv"
"strings"

"github.com/DataDog/zstd"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor"
"github.com/ipld/go-car"
"github.com/klauspost/compress/zstd"

"github.com/filecoin-project/venus/venus-shared/actors/adt"
blockstoreutil "github.com/filecoin-project/venus/venus-shared/blockstore"
Expand Down Expand Up @@ -193,8 +193,11 @@ func readEmbeddedBuiltinActorsMetadata(bundle string) ([]*BuiltinActorsMetadata,
}
defer fi.Close() //nolint

uncompressed := zstd.NewReader(fi)
defer uncompressed.Close() //nolint
uncompressed, err := zstd.NewReader(fi)
if err != nil {
return nil, err
}
defer uncompressed.Close()

var bundles []*BuiltinActorsMetadata

Expand Down Expand Up @@ -288,8 +291,11 @@ func GetEmbeddedBuiltinActorsBundle(version actorstypes.Version, networkBundleNa
}
defer fi.Close() //nolint

uncompressed := zstd.NewReader(fi)
defer uncompressed.Close() //nolint
uncompressed, err := zstd.NewReader(fi)
if err != nil {
return nil, false
}
defer uncompressed.Close()

tarReader := tar.NewReader(uncompressed)
targetFileName := fmt.Sprintf("builtin-actors-%s.car", networkBundleName)
Expand Down
Loading