From b372881e91b9059fa317a335371991bfa524e619 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Thu, 28 May 2020 01:15:19 +0200 Subject: [PATCH] Fix more lint warnings Signed-off-by: Jakub Sztandera --- cli/multisig.go | 2 +- cmd/lotus-bench/main.go | 2 +- cmd/lotus-seed/seed/seed.go | 2 +- cmd/lotus-storage-miner/init.go | 2 +- lib/lotuslog/levels.go | 19 +++++++++---------- node/impl/client/client.go | 3 +-- node/modules/lp2p/addrs.go | 2 +- 7 files changed, 15 insertions(+), 17 deletions(-) diff --git a/cli/multisig.go b/cli/multisig.go index 9acf1af08..37106dff5 100644 --- a/cli/multisig.go +++ b/cli/multisig.go @@ -207,7 +207,7 @@ var msigInspectCmd = &cli.Command{ fmt.Fprintf(w, "%d\t%s\t%s\t%s\t%d\t%x\n", txid, state(tx), tx.To, types.FIL(tx.Value), tx.Method, tx.Params) } if err := w.Flush(); err != nil { - return xerrors.Errorf("flushing ouput: %+v", err) + return xerrors.Errorf("flushing output: %+v", err) } } diff --git a/cmd/lotus-bench/main.go b/cmd/lotus-bench/main.go index b8740f2f3..cbb59309d 100644 --- a/cmd/lotus-bench/main.go +++ b/cmd/lotus-bench/main.go @@ -157,7 +157,7 @@ var sealBenchCmd = &cli.Command{ return err } - err = os.MkdirAll(sdir, 0775) + err = os.MkdirAll(sdir, 0775) //nolint:gosec if err != nil { return xerrors.Errorf("creating sectorbuilder dir: %w", err) } diff --git a/cmd/lotus-seed/seed/seed.go b/cmd/lotus-seed/seed/seed.go index 0f6539563..06cb011b4 100644 --- a/cmd/lotus-seed/seed/seed.go +++ b/cmd/lotus-seed/seed/seed.go @@ -48,7 +48,7 @@ func PreSeal(maddr address.Address, pt abi.RegisteredProof, offset abi.SectorNum SealProofType: spt, } - if err := os.MkdirAll(sbroot, 0775); err != nil { //golint:gosec + if err := os.MkdirAll(sbroot, 0775); err != nil { //nolint:gosec return nil, nil, err } diff --git a/cmd/lotus-storage-miner/init.go b/cmd/lotus-storage-miner/init.go index 7a6ac8257..0dcc9563b 100644 --- a/cmd/lotus-storage-miner/init.go +++ b/cmd/lotus-storage-miner/init.go @@ -389,7 +389,7 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api lapi.FullNode, if err != nil { return err } - defer lr.Close() //notlint:errcheck + defer lr.Close() //nolint:errcheck log.Info("Initializing libp2p identity") diff --git a/lib/lotuslog/levels.go b/lib/lotuslog/levels.go index c72d5a9c7..ae3959568 100644 --- a/lib/lotuslog/levels.go +++ b/lib/lotuslog/levels.go @@ -6,17 +6,16 @@ import ( logging "github.com/ipfs/go-log/v2" ) -//nolint:gosec func SetupLogLevels() { if _, set := os.LookupEnv("GOLOG_LOG_LEVEL"); !set { - logging.SetLogLevel("*", "INFO") - logging.SetLogLevel("dht", "ERROR") - logging.SetLogLevel("swarm2", "WARN") - logging.SetLogLevel("bitswap", "WARN") - //logging.SetLogLevel("pubsub", "WARN") - logging.SetLogLevel("connmgr", "WARN") - logging.SetLogLevel("advmgr", "DEBUG") - logging.SetLogLevel("stores", "DEBUG") - logging.SetLogLevel("nat", "INFO") + _ = logging.SetLogLevel("*", "INFO") + _ = logging.SetLogLevel("dht", "ERROR") + _ = logging.SetLogLevel("swarm2", "WARN") + _ = logging.SetLogLevel("bitswap", "WARN") + //_ = logging.SetLogLevel("pubsub", "WARN") + _ = logging.SetLogLevel("connmgr", "WARN") + _ = logging.SetLogLevel("advmgr", "DEBUG") + _ = logging.SetLogLevel("stores", "DEBUG") + _ = logging.SetLogLevel("nat", "INFO") } } diff --git a/node/impl/client/client.go b/node/impl/client/client.go index 01526fec2..7d6d5369b 100644 --- a/node/impl/client/client.go +++ b/node/impl/client/client.go @@ -435,7 +435,6 @@ func (a *API) ClientGenCar(ctx context.Context, ref api.FileRef, outputPath stri ssb.ExploreAll(ssb.ExploreRecursiveEdge())).Node() f, err := os.Create(outputPath) - defer f.Close() //nolint:errcheck if err != nil { return err } @@ -445,7 +444,7 @@ func (a *API) ClientGenCar(ctx context.Context, ref api.FileRef, outputPath stri return err } - return nil + return f.Close() } func (a *API) clientImport(ref api.FileRef, bufferedDS *ipld.BufferedDAG) (cid.Cid, error) { diff --git a/node/modules/lp2p/addrs.go b/node/modules/lp2p/addrs.go index da0de9ad9..afb8ce910 100644 --- a/node/modules/lp2p/addrs.go +++ b/node/modules/lp2p/addrs.go @@ -18,7 +18,7 @@ func AddrFilters(filters []string) func() (opts Libp2pOpts, err error) { if err != nil { return opts, fmt.Errorf("incorrectly formatted address filter in config: %s", s) } - opts.Opts = append(opts.Opts, libp2p.FilterAddresses(f)) //golint:staticcheck + opts.Opts = append(opts.Opts, libp2p.FilterAddresses(f)) //nolint:staticcheck } return opts, nil }