aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-01-07 01:30:44 +0800
committerGitHub <noreply@github.com>2017-01-07 01:30:44 +0800
commitac93a6ff6cd1200ab0fb67a5bd0c02cb70646632 (patch)
tree2b06aa1b360f1488264058d04e399e84b898f0d8 /cmd
parent444fc892b0a860218dab3e421d92c33408b9eb6d (diff)
parent13e3b2f433c48fe81423c1a13e9a5194ece61b01 (diff)
downloaddexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar
dexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.gz
dexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.bz2
dexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.lz
dexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.xz
dexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.tar.zst
dexon-ac93a6ff6cd1200ab0fb67a5bd0c02cb70646632.zip
Merge pull request #3525 from fjl/all-gosimple-cleanup
all: clean up lint issues, remove more dead code
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ethtest/main.go7
-rw-r--r--cmd/geth/accountcmd_test.go8
-rw-r--r--cmd/geth/main.go1
-rw-r--r--cmd/swarm/main.go6
-rw-r--r--cmd/utils/cmd.go3
5 files changed, 9 insertions, 16 deletions
diff --git a/cmd/ethtest/main.go b/cmd/ethtest/main.go
index 7ce663dc0..14b839579 100644
--- a/cmd/ethtest/main.go
+++ b/cmd/ethtest/main.go
@@ -88,12 +88,7 @@ func runTestWithReader(test string, r io.Reader) error {
default:
err = fmt.Errorf("Invalid test type specified: %v", test)
}
-
- if err != nil {
- return err
- }
-
- return nil
+ return err
}
func getFiles(path string) ([]string, error) {
diff --git a/cmd/geth/accountcmd_test.go b/cmd/geth/accountcmd_test.go
index b6abde6d8..113df983e 100644
--- a/cmd/geth/accountcmd_test.go
+++ b/cmd/geth/accountcmd_test.go
@@ -148,7 +148,7 @@ Passphrase: {{.InputLine "foobar"}}
"Unlocked account f466859ead1932d743d622cb74fc058882e8648a",
}
for _, m := range wantMessages {
- if strings.Index(geth.stderrText(), m) == -1 {
+ if !strings.Contains(geth.stderrText(), m) {
t.Errorf("stderr text does not contain %q", m)
}
}
@@ -193,7 +193,7 @@ Passphrase: {{.InputLine "foobar"}}
"Unlocked account 289d485d9771714cce91d3393d764e1311907acc",
}
for _, m := range wantMessages {
- if strings.Index(geth.stderrText(), m) == -1 {
+ if !strings.Contains(geth.stderrText(), m) {
t.Errorf("stderr text does not contain %q", m)
}
}
@@ -212,7 +212,7 @@ func TestUnlockFlagPasswordFile(t *testing.T) {
"Unlocked account 289d485d9771714cce91d3393d764e1311907acc",
}
for _, m := range wantMessages {
- if strings.Index(geth.stderrText(), m) == -1 {
+ if !strings.Contains(geth.stderrText(), m) {
t.Errorf("stderr text does not contain %q", m)
}
}
@@ -260,7 +260,7 @@ In order to avoid this warning, you need to remove the following duplicate key f
"Unlocked account f466859ead1932d743d622cb74fc058882e8648a",
}
for _, m := range wantMessages {
- if strings.Index(geth.stderrText(), m) == -1 {
+ if !strings.Contains(geth.stderrText(), m) {
t.Errorf("stderr text does not contain %q", m)
}
}
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index 332e1ae8d..766e49f49 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -168,7 +168,6 @@ func init() {
}
app.After = func(ctx *cli.Context) error {
- logger.Flush()
debug.Exit()
console.Stdin.Close() // Resets terminal mode.
return nil
diff --git a/cmd/swarm/main.go b/cmd/swarm/main.go
index 954ad3b13..71f53082a 100644
--- a/cmd/swarm/main.go
+++ b/cmd/swarm/main.go
@@ -129,7 +129,7 @@ func init() {
app.HideVersion = true // we have a command to print the version
app.Copyright = "Copyright 2013-2016 The go-ethereum Authors"
app.Commands = []cli.Command{
- cli.Command{
+ {
Action: version,
Name: "version",
Usage: "Print version numbers",
@@ -138,7 +138,7 @@ func init() {
The output of this command is supposed to be machine-readable.
`,
},
- cli.Command{
+ {
Action: upload,
Name: "up",
Usage: "upload a file or directory to swarm using the HTTP API",
@@ -147,7 +147,7 @@ The output of this command is supposed to be machine-readable.
"upload a file or directory to swarm using the HTTP API and prints the root hash",
`,
},
- cli.Command{
+ {
Action: hash,
Name: "hash",
Usage: "print the swarm hash of a file or directory",
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index a56507e4d..8666f3775 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -67,7 +67,6 @@ func Fatalf(format string, args ...interface{}) {
}
}
fmt.Fprintf(w, "Fatal: "+format+"\n", args...)
- logger.Flush()
os.Exit(1)
}
@@ -95,7 +94,7 @@ func StartNode(stack *node.Node) {
func FormatTransactionData(data string) []byte {
d := common.StringToByteFunc(data, func(s string) (ret []byte) {
- slice := regexp.MustCompile("\\n|\\s").Split(s, 1000000000)
+ slice := regexp.MustCompile(`\n|\s`).Split(s, 1000000000)
for _, dataItem := range slice {
d := common.FormatData(dataItem)
ret = append(ret, d...)