diff --git a/gnovm/cmd/gno/pkgaddr.go b/gnovm/cmd/gno/pkgaddr.go index baf4700de95..6f2b38ad172 100644 --- a/gnovm/cmd/gno/pkgaddr.go +++ b/gnovm/cmd/gno/pkgaddr.go @@ -2,7 +2,7 @@ package main import ( "context" - "fmt" + "flag" "github.com/gnolang/gno/gnovm/pkg/gnolang" "github.com/gnolang/gno/tm2/pkg/commands" @@ -24,7 +24,7 @@ func newPkgAddrCmd(io commands.IO) *commands.Command { func execPkgAddr(args []string, io commands.IO) error { if len(args) != 1 { - return fmt.Errorf("expected 1 arg, got %d", len(args)) + return flag.ErrHelp } io.Println(gnolang.DerivePkgAddr(args[0])) diff --git a/gnovm/cmd/gno/pkgaddr_test.go b/gnovm/cmd/gno/pkgaddr_test.go index 936daedbf4c..1969172ed0b 100644 --- a/gnovm/cmd/gno/pkgaddr_test.go +++ b/gnovm/cmd/gno/pkgaddr_test.go @@ -7,8 +7,13 @@ import ( func TestPkgAddrApp(t *testing.T) { tc := []testMainCase{ { - args: []string{"pkgaddr"}, - errShouldBe: "expected 1 arg, got 0", + args: []string{"pkgaddr"}, + errShouldContain: "flag: help requested", + }, + + { + args: []string{"pkgaddr", "bli", "blu"}, + errShouldContain: "flag: help requested", }, {