cmd/abigen: allow using abigen --pkg flag with standard input (#19207)

This commit is contained in:
Vitaly Bogdanov 2019-05-27 21:28:17 +03:00 committed by Guillaume Ballet
parent c4de228e18
commit 5429dc75bd

@ -81,7 +81,7 @@ func main() {
bins []string
types []string
)
if *solFlag != "" || *vyFlag != "" || (*abiFlag == "-" && *pkgFlag == "") {
if *solFlag != "" || *vyFlag != "" || *abiFlag == "-" {
// Generate the list of types to exclude from binding
exclude := make(map[string]bool)
for _, kind := range strings.Split(*excFlag, ",") {
@ -129,13 +129,8 @@ func main() {
}
} else {
// Otherwise load up the ABI, optional bytecode and type name from the parameters
var abi []byte
var err error
if *abiFlag == "-" {
abi, err = ioutil.ReadAll(os.Stdin)
} else {
abi, err = ioutil.ReadFile(*abiFlag)
}
abi, err := ioutil.ReadFile(*abiFlag)
if err != nil {
fmt.Printf("Failed to read input ABI: %v\n", err)
os.Exit(-1)