Commit 9c81387b authored by Michael Forney's avatar Michael Forney Committed by Felix Lange

cmd/evm: remove surrounding whitespace in hex input code (#20211)

This way, the output of `evm compile` can be used directly in `evm
--codefile code.txt run`, without stripping the trailing newline first.
parent 72617a07
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
package main package main
import ( import (
"bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
...@@ -145,6 +146,7 @@ func runCmd(ctx *cli.Context) error { ...@@ -145,6 +146,7 @@ func runCmd(ctx *cli.Context) error {
} else { } else {
hexcode = []byte(codeFlag) hexcode = []byte(codeFlag)
} }
hexcode = bytes.TrimSpace(hexcode)
if len(hexcode)%2 != 0 { if len(hexcode)%2 != 0 {
fmt.Printf("Invalid input length for hex data (%d)\n", len(hexcode)) fmt.Printf("Invalid input length for hex data (%d)\n", len(hexcode))
os.Exit(1) os.Exit(1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment