Fix lint warnings

This commit is contained in:
Łukasz Magiera 2019-07-11 13:52:07 +02:00
parent ffafc056ee
commit cd16e3e597
4 changed files with 10 additions and 7 deletions

View File

@ -18,7 +18,7 @@ var chainHeadCmd = &cli.Command{
Name: "head", Name: "head",
Usage: "Print chain head", Usage: "Print chain head",
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
api, err := getApi(cctx) api, err := getAPI(cctx)
if err != nil { if err != nil {
return err return err
} }

View File

@ -21,7 +21,7 @@ const (
// ApiConnector returns API instance // ApiConnector returns API instance
type ApiConnector func() api.API type ApiConnector func() api.API
func getApi(ctx *cli.Context) (api.API, error) { func getAPI(ctx *cli.Context) (api.API, error) {
r, err := repo.NewFS(ctx.String("repo")) r, err := repo.NewFS(ctx.String("repo"))
if err != nil { if err != nil {
return nil, err return nil, err
@ -32,6 +32,9 @@ func getApi(ctx *cli.Context) (api.API, error) {
return nil, err return nil, err
} }
_, addr, err := manet.DialArgs(ma) _, addr, err := manet.DialArgs(ma)
if err != nil {
return nil, err
}
return client.NewRPC("http://" + addr + "/rpc/v0"), nil return client.NewRPC("http://" + addr + "/rpc/v0"), nil
} }

View File

@ -26,7 +26,7 @@ var netPeers = &cli.Command{
Name: "peers", Name: "peers",
Usage: "Print peers", Usage: "Print peers",
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
api, err := getApi(cctx) api, err := getAPI(cctx)
if err != nil { if err != nil {
return err return err
} }
@ -48,7 +48,7 @@ var netListen = &cli.Command{
Name: "listen", Name: "listen",
Usage: "List listen addresses", Usage: "List listen addresses",
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
api, err := getApi(cctx) api, err := getAPI(cctx)
if err != nil { if err != nil {
return err return err
} }
@ -70,7 +70,7 @@ var netConnect = &cli.Command{
Name: "connect", Name: "connect",
Usage: "Connect to a peer", Usage: "Connect to a peer",
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
api, err := getApi(cctx) api, err := getAPI(cctx)
if err != nil { if err != nil {
return err return err
} }

View File

@ -62,7 +62,7 @@ func (fsr *FsRepo) Init() error {
log.Infof("Initializing repo at '%s'", fsr.path) log.Infof("Initializing repo at '%s'", fsr.path)
return os.Mkdir(fsr.path, 0755) return os.Mkdir(fsr.path, 0755) // nolint
} }
// APIEndpoint returns endpoint of API in this repo // APIEndpoint returns endpoint of API in this repo
@ -214,7 +214,7 @@ func (fsr *fsLockedRepo) SetAPIEndpoint(ma multiaddr.Multiaddr) error {
if err := fsr.stillValid(); err != nil { if err := fsr.stillValid(); err != nil {
return err return err
} }
return ioutil.WriteFile(fsr.join(fsAPI), []byte(ma.String()), 0666) return ioutil.WriteFile(fsr.join(fsAPI), []byte(ma.String()), 0644)
} }
func (fsr *fsLockedRepo) Wallet() (interface{}, error) { func (fsr *fsLockedRepo) Wallet() (interface{}, error) {