From cc814d6b7be48d193d3ecfbb45769ce587efc508 Mon Sep 17 00:00:00 2001 From: Cedrick Date: Mon, 20 Jan 2025 08:39:55 +0100 Subject: [PATCH] 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 --- cmd/abigen/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/abigen/main.go b/cmd/abigen/main.go index 0149dec527..8ee3130b5b 100644 --- a/cmd/abigen/main.go +++ b/cmd/abigen/main.go @@ -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":