From fe869c9c223e148b44efddca794a570145c1c3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Sun, 27 Sep 2020 21:06:07 +0100 Subject: [PATCH] address review comments; lint. --- cmd/tvx/extract.go | 2 +- cmd/tvx/main.go | 4 +++- cmd/tvx/state.go | 2 +- cmd/tvx/stores.go | 4 +++- conformance/driver.go | 2 +- conformance/reporter.go | 8 ++++---- conformance/runner.go | 2 +- 7 files changed, 14 insertions(+), 10 deletions(-) diff --git a/cmd/tvx/extract.go b/cmd/tvx/extract.go index 06b3d6fe8..d3faa6d6d 100644 --- a/cmd/tvx/extract.go +++ b/cmd/tvx/extract.go @@ -304,7 +304,7 @@ func runExtract(_ *cli.Context) error { if err != nil { return err } - defer output.Close() + defer output.Close() //nolint:errcheck defer log.Printf("wrote test vector to file: %s", file) } diff --git a/cmd/tvx/main.go b/cmd/tvx/main.go index 183c2fbe1..2ab217953 100644 --- a/cmd/tvx/main.go +++ b/cmd/tvx/main.go @@ -23,7 +23,9 @@ var apiEndpoint string var apiFlag = cli.StringFlag{ Name: "api", - Usage: "json-rpc api endpoint, formatted as token:multiaddr", + Usage: "json-rpc api endpoint, formatted as [token]:multiaddr;" + + "tvx uses unpriviliged operations, so the token may be omitted," + + "but permissions may change in the future", EnvVars: []string{"FULLNODE_API_INFO"}, DefaultText: "", Destination: &apiEndpoint, diff --git a/cmd/tvx/state.go b/cmd/tvx/state.go index cef5c5494..5bf1cf153 100644 --- a/cmd/tvx/state.go +++ b/cmd/tvx/state.go @@ -9,7 +9,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/ipfs/go-cid" - "github.com/ipfs/go-ipld-format" + format "github.com/ipfs/go-ipld-format" "github.com/ipld/go-car" cbg "github.com/whyrusleeping/cbor-gen" diff --git a/cmd/tvx/stores.go b/cmd/tvx/stores.go index 7d3fd5e3a..c389f8c88 100644 --- a/cmd/tvx/stores.go +++ b/cmd/tvx/stores.go @@ -6,6 +6,7 @@ import ( "sync" "github.com/fatih/color" + dssync "github.com/ipfs/go-datastore/sync" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/lib/blockstore" @@ -40,7 +41,8 @@ type Stores struct { // proxies Get requests for unknown CIDs to a Filecoin node, via the // ChainReadObj RPC. func NewProxyingStores(ctx context.Context, api api.FullNode) *Stores { - ds := ds.NewMapDatastore() + ds := dssync.MutexWrap(ds.NewMapDatastore()) + ds = dssync.MutexWrap(ds) bs := &proxyingBlockstore{ ctx: ctx, diff --git a/conformance/driver.go b/conformance/driver.go index fdd4fe3a9..90d05ae88 100644 --- a/conformance/driver.go +++ b/conformance/driver.go @@ -33,7 +33,7 @@ var ( type Driver struct { ctx context.Context selector schema.Selector - vmFlush bool + vmFlush bool } type DriverOpts struct { diff --git a/conformance/reporter.go b/conformance/reporter.go index 747caae32..1cd2d389d 100644 --- a/conformance/reporter.go +++ b/conformance/reporter.go @@ -33,17 +33,17 @@ type LogReporter struct { var _ Reporter = (*LogReporter)(nil) -func (_ *LogReporter) Helper() {} +func (*LogReporter) Helper() {} -func (_ *LogReporter) Log(args ...interface{}) { +func (*LogReporter) Log(args ...interface{}) { log.Println(args...) } -func (_ *LogReporter) Logf(format string, args ...interface{}) { +func (*LogReporter) Logf(format string, args ...interface{}) { log.Printf(format, args...) } -func (_ *LogReporter) FailNow() { +func (*LogReporter) FailNow() { os.Exit(1) } diff --git a/conformance/runner.go b/conformance/runner.go index 6ffdcd2eb..456955b25 100644 --- a/conformance/runner.go +++ b/conformance/runner.go @@ -164,7 +164,7 @@ func dumpThreeWayStateDiff(r Reporter, vector *schema.TestVector, bs blockstore. if err != nil { r.Fatalf("failed to write temporary state CAR: %s", err) } - defer os.RemoveAll(tmpCar) + defer os.RemoveAll(tmpCar) //nolint:errcheck color.NoColor = false // enable colouring.