gops icon indicating copy to clipboard operation
gops copied to clipboard

Check pid/addr of target process was specified for subcommands

Open sudo-suhas opened this issue 7 years ago • 3 comments

gops panics if anything other than help was invoked without specifying the pid/addr of the target:

λ gops stats
panic: runtime error: index out of range

goroutine 1 [running]:
main.main()
        E:/Installs/go-tools/src/github.com/google/gops/main.go:68 +0x48a

This adds a check and prints the usage if it was not specified.

λ go run main.go cmd.go stats
gops: pid/addr of target process not specified
gops is a tool to list and diagnose Go processes.

        gops <cmd> <pid|addr> ...
        gops <pid> # displays process info

...

All commands require the agent running on the Go process.
Symbol "*" indicates the process runs the agent.
exit status 1

sudo-suhas avatar Mar 04 '18 02:03 sudo-suhas

Thank you @sudo-suhas for the fix. This looks like the result of a regression from this PR https://github.com/google/gops/pull/59/files#diff-7ddfb3e035b42cd70649cc33393fe32cL55 so basically reverting it.

@rakyll would have more context as to why we removed that check in that PR #59.

odeke-em avatar Mar 04 '18 06:03 odeke-em

Can you rebase this PR?

rakyll avatar May 02 '18 12:05 rakyll

Done

sudo-suhas avatar May 02 '18 14:05 sudo-suhas