diff --git a/cli/net.go b/cli/net.go index 18f21f767fc..524b0d753e5 100644 --- a/cli/net.go +++ b/cli/net.go @@ -643,9 +643,7 @@ var NetStatCmd = &cli.Command{ } enc := json.NewEncoder(os.Stdout) - enc.Encode(result) - - return nil + return enc.Encode(result) }, } @@ -694,21 +692,19 @@ var NetLimitCmd = &cli.Command{ return api.NetSetLimit(ctx, scope, limit) - } else { - if len(args) != 1 { - return xerrors.Errorf("must specify exactly one scope") - } - scope := args[0] + } - result, err := api.NetLimit(ctx, scope) - if err != nil { - return err - } + if len(args) != 1 { + return xerrors.Errorf("must specify exactly one scope") + } + scope := args[0] - enc := json.NewEncoder(os.Stdout) - enc.Encode(result) + result, err := api.NetLimit(ctx, scope) + if err != nil { + return err } - return nil + enc := json.NewEncoder(os.Stdout) + return enc.Encode(result) }, } diff --git a/node/modules/lp2p/rcmgr.go b/node/modules/lp2p/rcmgr.go index a012fc1f427..df52b4a4f39 100644 --- a/node/modules/lp2p/rcmgr.go +++ b/node/modules/lp2p/rcmgr.go @@ -26,7 +26,7 @@ func ResourceManager(lc fx.Lifecycle, repo repo.LockedRepo) (network.ResourceMan limitsIn, err := os.Open(limitsFile) switch { case err == nil: - defer limitsIn.Close() + defer limitsIn.Close() //nolint:errcheck limiter, err = rcmgr.NewDefaultLimiterFromJSON(limitsIn) if err != nil { return nil, fmt.Errorf("error parsing limit file: %w", err)