cmd/abigen: require either `--abi` or `--combined-json` (#31045)

This PR addresses issue #30768 , which highlights that running
cmd/abigen/abigen --pkg my_package example.json (erroneously omitting
the --abi flag) generates an empty binding, when it should fail
explicitly.

---------

Co-authored-by: jwasinger <j-wasinger@hotmail.com>
pull/31050/head
Cedrick 2 weeks ago committed by GitHub
parent ea31bd9faf
commit cc814d6b7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 3
      cmd/abigen/main.go

@ -98,6 +98,9 @@ func abigen(c *cli.Context) error {
if c.String(pkgFlag.Name) == "" { if c.String(pkgFlag.Name) == "" {
utils.Fatalf("No destination package specified (--pkg)") utils.Fatalf("No destination package specified (--pkg)")
} }
if c.String(abiFlag.Name) == "" && c.String(jsonFlag.Name) == "" {
utils.Fatalf("Either contract ABI source (--abi) or combined-json (--combined-json) are required")
}
var lang bind.Lang var lang bind.Lang
switch c.String(langFlag.Name) { switch c.String(langFlag.Name) {
case "go": case "go":

Loading…
Cancel
Save