Fix some more linter errors

This commit is contained in:
Geoff Stuart 2022-11-25 16:19:20 -05:00
parent e737c1e960
commit b55e121642
9 changed files with 34 additions and 11 deletions

View File

@ -102,7 +102,7 @@ func ParseFIL(s string) (FIL, error) {
return FIL{}, fmt.Errorf("string length too large: %d", len(s))
}
r, ok := new(big.Rat).SetString(s)
r, ok := new(big.Rat).SetString(s) //nolint:gosec
if !ok {
return FIL{}, fmt.Errorf("failed to parse %q as a decimal number", s)
}

View File

@ -149,7 +149,7 @@ var importBenchCmd = &cli.Command{
http.Handle("/debug/metrics", exporter)
http.ListenAndServe("localhost:6060", nil) //nolint:errcheck
_ = http.ListenAndServe("localhost:6060", nil)
}()
var tdir string
@ -771,7 +771,7 @@ var importAnalyzeCmd = &cli.Command{
}
go func() {
http.ListenAndServe("localhost:6060", nil) //nolint:errcheck
_ = http.ListenAndServe("localhost:6060", nil)
}()
fi, err := os.Open(cctx.Args().First())

View File

@ -127,7 +127,12 @@ var runCmd = &cli.Command{
os.Exit(0)
}()
return http.ListenAndServe(cctx.String("front"), nil)
server := &http.Server{
Addr: cctx.String("front"),
ReadHeaderTimeout: 3 * time.Second,
}
return server.ListenAndServe()
},
}

View File

@ -421,7 +421,7 @@ var runCmd = &cli.Command{
},
Action: func(cctx *cli.Context) error {
go func() {
http.ListenAndServe(":6060", nil) //nolint:errcheck
_ = http.ListenAndServe(":6060", nil)
}()
ctx := context.Background()

View File

@ -219,7 +219,7 @@ var finalResultCmd = &cli.Command{
// TODO: Confirm that these are always ID addresses
signers, err := ms.Signers()
if err != nil {
return xerrors.Errorf("fail to get msig signers", err)
return xerrors.Errorf("fail to get msig signers: %w", err)
}
for _, s := range signers {
signerId := lookupId(s)
@ -244,12 +244,12 @@ var finalResultCmd = &cli.Command{
if builtin.IsStorageMinerActor(act.Code) {
m, err := miner.Load(store, act)
if err != nil {
return xerrors.Errorf("fail to load miner actor: \n", err)
return xerrors.Errorf("fail to load miner actor: %w", err)
}
info, err := m.Info()
if err != nil {
return xerrors.Errorf("fail to get miner info: \n", err)
return xerrors.Errorf("fail to get miner info: %w\n", err)
}
ownerId := lookupId(info.Owner)
@ -353,7 +353,7 @@ var finalResultCmd = &cli.Command{
//process votes for regular accounts
accountActor, err := st.GetActor(signerId)
if err != nil {
return xerrors.Errorf("fail to get account account for signer: ", err)
return xerrors.Errorf("fail to get account account for signer: %w\n", err)
}
clientBytes, ok := clientToDealStorage[signerId]

View File

@ -234,6 +234,9 @@ var replayOfflineCmd = &cli.Command{
return xerrors.Errorf("could not find message within the last %d epochs", lookbackLimit)
}
executionTs, err := cs.GetTipsetByHeight(ctx, ts.Height()-2, ts, true)
if err != nil {
return err
}
tw := tabwriter.NewWriter(os.Stdout, 8, 2, 2, ' ', tabwriter.AlignRight)
res, err := sm.CallWithGas(ctx, msg, []types.ChainMsg{}, executionTs)

View File

@ -98,6 +98,9 @@ var invariantsCmd = &cli.Command{
fmt.Println("Network Version ", nv)
av, err := actorstypes.VersionForNetwork(nv)
if err != nil {
return err
}
fmt.Println("Actors Version ", av)
actorCodeCids, err := actors.GetActorCodeIDs(av)
@ -114,6 +117,9 @@ var invariantsCmd = &cli.Command{
}
actorTree, err := builtin.LoadTree(actorStore, stateRoot.Actors)
if err != nil {
return err
}
startTime := time.Now()

View File

@ -93,7 +93,12 @@ var mpoolStatsCmd = &cli.Command{
http.Handle("/debug/metrics", expo)
go func() {
if err := http.ListenAndServe(":10555", nil); err != nil {
server := &http.Server{
Addr: ":10555",
ReadHeaderTimeout: 3 * time.Second,
}
if err := server.ListenAndServe(); err != nil {
panic(err)
}
}()

View File

@ -160,7 +160,11 @@ var runCmd = &cli.Command{
go func() {
http.Handle("/metrics", exporter)
if err := http.ListenAndServe(":6688", nil); err != nil {
server := &http.Server{
Addr: ":6688",
ReadHeaderTimeout: 3 * time.Second,
}
if err := server.ListenAndServe(); err != nil {
log.Errorw("failed to start http server", "err", err)
}
}()