lint for config pr

This commit is contained in:
Andrew Jackson (Ajax) 2023-09-20 12:58:56 -05:00
parent a377033d22
commit 144bc9fcea
3 changed files with 15 additions and 7 deletions

View File

@ -9,10 +9,11 @@ import (
"strings"
"github.com/BurntSushi/toml"
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
"github.com/filecoin-project/lotus/node/config"
"github.com/kr/pretty"
"github.com/urfave/cli/v2"
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
"github.com/filecoin-project/lotus/node/config"
)
var configCmd = &cli.Command{
@ -57,7 +58,7 @@ var configSetCmd = &cli.Command{
Action: func(cctx *cli.Context) error {
args := cctx.Args()
if args.Len() != 1 {
return errors.New("Must have exactly 1 arg for the file name.")
return errors.New("must have exactly 1 arg for the file name")
}
db, err := makeDB(cctx)
if err != nil {
@ -71,7 +72,10 @@ var configSetCmd = &cli.Command{
}
lp := config.DefaultLotusProvider() // ensure it's toml
toml.Decode(string(bytes), lp)
_, err = toml.Decode(string(bytes), lp)
if err != nil {
return fmt.Errorf("cannot decode file: %w", err)
}
_ = lp
name := strings.Split(fn, ".")[0]
@ -94,7 +98,7 @@ var configGetCmd = &cli.Command{
Action: func(cctx *cli.Context) error {
args := cctx.Args()
if args.Len() != 1 {
return errors.New("Must have exactly 1 arg for the layer name.")
return fmt.Errorf("want 1 layer arg, got %d", args.Len())
}
db, err := makeDB(cctx)
if err != nil {
@ -122,7 +126,10 @@ var configListCmd = &cli.Command{
return err
}
var res []string
db.Select(context.Background(), &res, `SELECT title FROM harmony_confg ORDER BY title`)
err = db.Select(context.Background(), &res, `SELECT title FROM harmony_confg ORDER BY title`)
if err != nil {
return fmt.Errorf("unable to read from db: %w", err)
}
for _, r := range res {
fmt.Println(r)
}

2
go.mod
View File

@ -108,6 +108,7 @@ require (
github.com/jackc/pgx/v5 v5.4.1
github.com/kelseyhightower/envconfig v1.4.0
github.com/koalacxr/quantile v0.0.1
github.com/kr/pretty v0.3.1
github.com/libp2p/go-buffer-pool v0.1.0
github.com/libp2p/go-libp2p v0.27.6
github.com/libp2p/go-libp2p-consensus v0.0.1
@ -273,7 +274,6 @@ require (
github.com/klauspost/compress v1.16.5 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/libp2p/go-cidranger v1.1.0 // indirect

View File

@ -71,6 +71,7 @@ type LotusProviderConfig struct {
Fees LotusProviderFees
Addresses LotusProviderAddresses
Proving ProvingConfig
}
type DAGStoreConfig struct {