ProspectOne / perfops-cli

A simple command line tool to interact with hundreds of servers around the world.
https://perfops.net/cli
288 stars 45 forks source link

limit bug #13

Closed jimaek closed 7 years ago

jimaek commented 7 years ago
perfops latency --from asia --limit 10 google.com
Error: json: cannot unmarshal number into Go struct field RunResult.output of type string
Usage:
  perfops latency [target] [flags]

Flags:
  -h, --help        help for latency
  -L, --limit int   The limit (default 1)

Global Flags:
  -F, --from string   A continent, region (e.g eastern europe), country, US state or city
  -K, --key string    The PerfOps API key (default is $PERFOPS_API_KEY)
  -v, --version       Prints the version information of perfops

json: cannot unmarshal number into Go struct field RunResult.output of type string
boki commented 7 years ago

The issue is not related to the limit but to a package loss in one of the result items. The resulting value of -1 in output violates the model's definition of string:

"result": {
    "output": -1,
    "message": "100% packet loss",
    "node": {

vs.

"result": {
    "ip": "74.125.200.113",
    "output": "35.223",
    "node": {

Ideally the number would be serialized as "-1". I changed the model to accept any type.