Skip to content

Commit

Permalink
cmd/abigen: require either --abi or --combined-json (#31045)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
cedrick-ah and jwasinger authored Jan 20, 2025
1 parent ea31bd9 commit cc814d6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/abigen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ func abigen(c *cli.Context) error {
if c.String(pkgFlag.Name) == "" {
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
switch c.String(langFlag.Name) {
case "go":
Expand Down

0 comments on commit cc814d6

Please sign in to comment.