cmd: various golint fixes (#16700)

* cmd: various golint fixes

* cmd: update to pr change request

* cmd: update to pr change request
This commit is contained in:
kiel barry 2018-05-09 00:38:03 -07:00 committed by Péter Szilágyi
parent c60f6f6214
commit 4ea493e7eb
5 changed files with 28 additions and 24 deletions

View File

@ -47,11 +47,11 @@ import (
"gopkg.in/urfave/cli.v1" "gopkg.in/urfave/cli.v1"
) )
// ExternalApiVersion -- see extapi_changelog.md // ExternalAPIVersion -- see extapi_changelog.md
const ExternalApiVersion = "2.0.0" const ExternalAPIVersion = "2.0.0"
// InternalApiVersion -- see intapi_changelog.md // InternalAPIVersion -- see intapi_changelog.md
const InternalApiVersion = "2.0.0" const InternalAPIVersion = "2.0.0"
const legalWarning = ` const legalWarning = `
WARNING! WARNING!
@ -398,10 +398,10 @@ func signer(c *cli.Context) error {
} }
// register signer API with server // register signer API with server
var ( var (
extapiUrl = "n/a" extapiURL = "n/a"
ipcApiUrl = "n/a" ipcapiURL = "n/a"
) )
rpcApi := []rpc.API{ rpcAPI := []rpc.API{
{ {
Namespace: "account", Namespace: "account",
Public: true, Public: true,
@ -415,12 +415,12 @@ func signer(c *cli.Context) error {
// start http server // start http server
httpEndpoint := fmt.Sprintf("%s:%d", c.String(utils.RPCListenAddrFlag.Name), c.Int(rpcPortFlag.Name)) httpEndpoint := fmt.Sprintf("%s:%d", c.String(utils.RPCListenAddrFlag.Name), c.Int(rpcPortFlag.Name))
listener, _, err := rpc.StartHTTPEndpoint(httpEndpoint, rpcApi, []string{"account"}, cors, vhosts) listener, _, err := rpc.StartHTTPEndpoint(httpEndpoint, rpcAPI, []string{"account"}, cors, vhosts)
if err != nil { if err != nil {
utils.Fatalf("Could not start RPC api: %v", err) utils.Fatalf("Could not start RPC api: %v", err)
} }
extapiUrl = fmt.Sprintf("http://%s", httpEndpoint) extapiURL = fmt.Sprintf("http://%s", httpEndpoint)
log.Info("HTTP endpoint opened", "url", extapiUrl) log.Info("HTTP endpoint opened", "url", extapiURL)
defer func() { defer func() {
listener.Close() listener.Close()
@ -430,19 +430,19 @@ func signer(c *cli.Context) error {
} }
if !c.Bool(utils.IPCDisabledFlag.Name) { if !c.Bool(utils.IPCDisabledFlag.Name) {
if c.IsSet(utils.IPCPathFlag.Name) { if c.IsSet(utils.IPCPathFlag.Name) {
ipcApiUrl = c.String(utils.IPCPathFlag.Name) ipcapiURL = c.String(utils.IPCPathFlag.Name)
} else { } else {
ipcApiUrl = filepath.Join(configDir, "clef.ipc") ipcapiURL = filepath.Join(configDir, "clef.ipc")
} }
listener, _, err := rpc.StartIPCEndpoint(ipcApiUrl, rpcApi) listener, _, err := rpc.StartIPCEndpoint(ipcapiURL, rpcAPI)
if err != nil { if err != nil {
utils.Fatalf("Could not start IPC api: %v", err) utils.Fatalf("Could not start IPC api: %v", err)
} }
log.Info("IPC endpoint opened", "url", ipcApiUrl) log.Info("IPC endpoint opened", "url", ipcapiURL)
defer func() { defer func() {
listener.Close() listener.Close()
log.Info("IPC endpoint closed", "url", ipcApiUrl) log.Info("IPC endpoint closed", "url", ipcapiURL)
}() }()
} }
@ -453,10 +453,10 @@ func signer(c *cli.Context) error {
} }
ui.OnSignerStartup(core.StartupInfo{ ui.OnSignerStartup(core.StartupInfo{
Info: map[string]interface{}{ Info: map[string]interface{}{
"extapi_version": ExternalApiVersion, "extapi_version": ExternalAPIVersion,
"intapi_version": InternalApiVersion, "intapi_version": InternalAPIVersion,
"extapi_http": extapiUrl, "extapi_http": extapiURL,
"extapi_ipc": ipcApiUrl, "extapi_ipc": ipcapiURL,
}, },
}) })

View File

@ -32,6 +32,8 @@ type JSONLogger struct {
cfg *vm.LogConfig cfg *vm.LogConfig
} }
// NewJSONLogger creates a new EVM tracer that prints execution steps as JSON objects
// into the provided stream.
func NewJSONLogger(cfg *vm.LogConfig, writer io.Writer) *JSONLogger { func NewJSONLogger(cfg *vm.LogConfig, writer io.Writer) *JSONLogger {
return &JSONLogger{json.NewEncoder(writer), cfg} return &JSONLogger{json.NewEncoder(writer), cfg}
} }

View File

@ -38,6 +38,8 @@ var stateTestCommand = cli.Command{
ArgsUsage: "<file>", ArgsUsage: "<file>",
} }
// StatetestResult contains the execution status after running a state test, any
// error that might have occurred and a dump of the final state if requested.
type StatetestResult struct { type StatetestResult struct {
Name string `json:"name"` Name string `json:"name"`
Pass bool `json:"pass"` Pass bool `json:"pass"`

View File

@ -340,7 +340,7 @@ func importWallet(ctx *cli.Context) error {
if len(keyfile) == 0 { if len(keyfile) == 0 {
utils.Fatalf("keyfile must be given as argument") utils.Fatalf("keyfile must be given as argument")
} }
keyJson, err := ioutil.ReadFile(keyfile) keyJSON, err := ioutil.ReadFile(keyfile)
if err != nil { if err != nil {
utils.Fatalf("Could not read wallet file: %v", err) utils.Fatalf("Could not read wallet file: %v", err)
} }
@ -349,7 +349,7 @@ func importWallet(ctx *cli.Context) error {
passphrase := getPassPhrase("", false, 0, utils.MakePasswordList(ctx)) passphrase := getPassPhrase("", false, 0, utils.MakePasswordList(ctx))
ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore) ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
acct, err := ks.ImportPreSaleKey(keyJson, passphrase) acct, err := ks.ImportPreSaleKey(keyJSON, passphrase)
if err != nil { if err != nil {
utils.Fatalf("%v", err) utils.Fatalf("%v", err)
} }

View File

@ -41,7 +41,7 @@ var bugCommand = cli.Command{
Category: "MISCELLANEOUS COMMANDS", Category: "MISCELLANEOUS COMMANDS",
} }
const issueUrl = "https://github.com/ethereum/go-ethereum/issues/new" const issueURL = "https://github.com/ethereum/go-ethereum/issues/new"
// reportBug reports a bug by opening a new URL to the go-ethereum GH issue // reportBug reports a bug by opening a new URL to the go-ethereum GH issue
// tracker and setting default values as the issue body. // tracker and setting default values as the issue body.
@ -58,8 +58,8 @@ func reportBug(ctx *cli.Context) error {
fmt.Fprintln(&buff, header) fmt.Fprintln(&buff, header)
// open a new GH issue // open a new GH issue
if !browser.Open(issueUrl + "?body=" + url.QueryEscape(buff.String())) { if !browser.Open(issueURL + "?body=" + url.QueryEscape(buff.String())) {
fmt.Printf("Please file a new issue at %s using this template:\n\n%s", issueUrl, buff.String()) fmt.Printf("Please file a new issue at %s using this template:\n\n%s", issueURL, buff.String())
} }
return nil return nil
} }