Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commands: fix mismatch in argument error reporting #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions cmd/viewcore/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,18 +616,18 @@ func runObjects(cmd *cobra.Command, args []string) {
}

func runReachable(cmd *cobra.Command, args []string) {
_, c, err := readCore()
n, err := strconv.ParseInt(args[0], 16, 64)
if err != nil {
exitf("%v\n", err)
exitf("can't parse %q as an object address\n", args[0])
}
n, err := strconv.ParseInt(args[0], 16, 64)
_, c, err := readCore()
if err != nil {
exitf("can't parse %q as an object address\n", args[1])
exitf("%v\n", err)
}
a := core.Address(n)
obj, _ := c.FindObject(a)
if obj == 0 {
exitf("can't find object at address %s\n", args[1])
exitf("can't find object at address %s\n", args[0])
}

// Breadth-first search backwards until we reach a root.
Expand Down Expand Up @@ -728,21 +728,21 @@ func runHTML(cmd *cobra.Command, args []string) {
}

func runRead(cmd *cobra.Command, args []string) {
p, _, err := readCore()
n, err := strconv.ParseInt(args[0], 16, 64)
if err != nil {
exitf("%v\n", err)
exitf("can't parse %q as an object address\n", args[0])
}
n, err := strconv.ParseInt(args[0], 16, 64)
p, _, err := readCore()
if err != nil {
exitf("can't parse %q as an object address\n", args[1])
exitf("%v\n", err)
}
a := core.Address(n)
if len(args) < 2 {
n = 256
} else {
n, err = strconv.ParseInt(args[1], 10, 64)
if err != nil {
exitf("can't parse %q as a byte count\n", args[2])
exitf("can't parse %q as a byte count\n", args[1])
}
}
if !p.ReadableN(a, n) {
Expand Down