cmd/evm: fix some linter error

This commit is contained in:
terasum 2018-07-31 11:30:13 +08:00
parent 57eef63478
commit a57277e9a7
2 changed files with 7 additions and 7 deletions

View file

@ -45,6 +45,6 @@ func disasmCmd(ctx *cli.Context) error {
} }
code := strings.TrimSpace(string(in[:])) code := strings.TrimSpace(string(in[:]))
fmt.Fprintf(ctx.App.Writer,"%v\n", code) fmt.Fprintf(ctx.App.Writer, "%v\n", code)
return asm.PrintDisassembled(code) return asm.PrintDisassembled(code)
} }

View file

@ -128,13 +128,13 @@ func runCmd(ctx *cli.Context) error {
if ctx.GlobalString(CodeFileFlag.Name) == "-" { if ctx.GlobalString(CodeFileFlag.Name) == "-" {
//Try reading from stdin //Try reading from stdin
if hexcode, err = ioutil.ReadAll(os.Stdin); err != nil { if hexcode, err = ioutil.ReadAll(os.Stdin); err != nil {
fmt.Fprintf(ctx.App.ErrWriter,"Could not load code from stdin: %v\n", err) fmt.Fprintf(ctx.App.ErrWriter, "Could not load code from stdin: %v\n", err)
os.Exit(1) os.Exit(1)
} }
} else { } else {
// Codefile with hex assembly // Codefile with hex assembly
if hexcode, err = ioutil.ReadFile(ctx.GlobalString(CodeFileFlag.Name)); err != nil { if hexcode, err = ioutil.ReadFile(ctx.GlobalString(CodeFileFlag.Name)); err != nil {
fmt.Fprintf(ctx.App.ErrWriter,"Could not load code from file: %v\n", err) fmt.Fprintf(ctx.App.ErrWriter, "Could not load code from file: %v\n", err)
os.Exit(1) os.Exit(1)
} }
} }
@ -172,11 +172,11 @@ func runCmd(ctx *cli.Context) error {
if cpuProfilePath := ctx.GlobalString(CPUProfileFlag.Name); cpuProfilePath != "" { if cpuProfilePath := ctx.GlobalString(CPUProfileFlag.Name); cpuProfilePath != "" {
f, err := os.Create(cpuProfilePath) f, err := os.Create(cpuProfilePath)
if err != nil { if err != nil {
fmt.Fprintf(ctx.App.ErrWriter,"could not create CPU profile: %v\n", err) fmt.Fprintf(ctx.App.ErrWriter, "could not create CPU profile: %v\n", err)
os.Exit(1) os.Exit(1)
} }
if err := pprof.StartCPUProfile(f); err != nil { if err := pprof.StartCPUProfile(f); err != nil {
fmt.Fprintf(ctx.App.ErrWriter,"could not start CPU profile: %v\n", err) fmt.Fprintf(ctx.App.ErrWriter, "could not start CPU profile: %v\n", err)
os.Exit(1) os.Exit(1)
} }
defer pprof.StopCPUProfile() defer pprof.StopCPUProfile()
@ -206,11 +206,11 @@ func runCmd(ctx *cli.Context) error {
if memProfilePath := ctx.GlobalString(MemProfileFlag.Name); memProfilePath != "" { if memProfilePath := ctx.GlobalString(MemProfileFlag.Name); memProfilePath != "" {
f, err := os.Create(memProfilePath) f, err := os.Create(memProfilePath)
if err != nil { if err != nil {
fmt.Fprintln(ctx.App.ErrWriter,"could not create memory profile: %v\n", err) fmt.Fprintf(ctx.App.ErrWriter, "could not create memory profile: %v\n", err)
os.Exit(1) os.Exit(1)
} }
if err := pprof.WriteHeapProfile(f); err != nil { if err := pprof.WriteHeapProfile(f); err != nil {
fmt.Fprintln(ctx.App.ErrWriter,"could not create memory profile: %v\n", err) fmt.Fprintf(ctx.App.ErrWriter, "could not create memory profile: %v\n", err)
os.Exit(1) os.Exit(1)
} }
f.Close() f.Close()