This commit is contained in:
vyzo 2022-01-20 11:46:39 +02:00
parent b360c9403f
commit 325a4c0e5b
2 changed files with 14 additions and 18 deletions

View File

@ -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
}
enc := json.NewEncoder(os.Stdout)
enc.Encode(result)
}
return nil
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
}
enc := json.NewEncoder(os.Stdout)
return enc.Encode(result)
},
}

View File

@ -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)