newrelic-cli
newrelic-cli copied to clipboard
Panic: NRQL query with text output
Description
Table formatting can cause a panic on NRQL results.
Go Version
CLI version 0.10.0 (Installed via Homebrew)
go version go1.14.4 darwin/amd64
Current behavior
CLI panics
Expected behavior
Results would be printed in a table
Steps To Reproduce
$ newrelic nrql query \
--accountId $NEW_RELIC_ACCOUNT_ID \
--query 'FROM NrAuditEvent SELECT count(*) FACET targetType SINCE 1 week ago' \
--format text
panic: reflect: NumField of non-struct type nrdb.NrdbResult
goroutine 1 [running]:
reflect.(*rtype).NumField(0x1574dc0, 0x16f0ce0)
/usr/local/Cellar/go/1.14.4/libexec/src/reflect/type.go:973 +0xb7
github.com/newrelic/newrelic-cli/internal/output.(*Output).renderAsTable(0xc0000a6300, 0x152f740, 0xc0001f1140, 0x0, 0x8)
/private/tmp/newrelic-cli-20200710-99399-1jjc2iq/newrelic-cli-0.10.0/internal/output/text.go:54 +0x16d
github.com/newrelic/newrelic-cli/internal/output.(*Output).text(0xc0000a6300, 0x152f740, 0xc0001f1140, 0x1551f20, 0xc000169301)
/private/tmp/newrelic-cli-20200710-99399-1jjc2iq/newrelic-cli-0.10.0/internal/output/text.go:28 +0xc7
github.com/newrelic/newrelic-cli/internal/output.Print(0x152f740, 0xc0001f1140, 0x4, 0xc0001f1140)
/private/tmp/newrelic-cli-20200710-99399-1jjc2iq/newrelic-cli-0.10.0/internal/output/print.go:19 +0xdc
github.com/newrelic/newrelic-cli/internal/nrql.glob..func1.1(0xc000192000)
/private/tmp/newrelic-cli-20200710-99399-1jjc2iq/newrelic-cli-0.10.0/internal/nrql/command_query.go:38 +0xff
github.com/newrelic/newrelic-cli/internal/client.WithClientFrom.func1.1(0xc00017f110)
/private/tmp/newrelic-cli-20200710-99399-1jjc2iq/newrelic-cli-0.10.0/internal/client/helpers.go:25 +0xb1
github.com/newrelic/newrelic-cli/internal/credentials.WithCredentialsFrom(0xc0000f2e00, 0x19, 0xc000125c70)
/private/tmp/newrelic-cli-20200710-99399-1jjc2iq/newrelic-cli-0.10.0/internal/credentials/helpers.go:21 +0xa9
github.com/newrelic/newrelic-cli/internal/client.WithClientFrom.func1(0xc0000d2f00)
/private/tmp/newrelic-cli-20200710-99399-1jjc2iq/newrelic-cli-0.10.0/internal/client/helpers.go:19 +0x6d
github.com/newrelic/newrelic-cli/internal/config.WithConfigFrom(0xc0000f2e00, 0x19, 0xc000125d00)
/private/tmp/newrelic-cli-20200710-99399-1jjc2iq/newrelic-cli-0.10.0/internal/config/helpers.go:19 +0xa9
github.com/newrelic/newrelic-cli/internal/client.WithClientFrom(0xc0000f2e00, 0x19, 0x1634ff0)
/private/tmp/newrelic-cli-20200710-99399-1jjc2iq/newrelic-cli-0.10.0/internal/client/helpers.go:18 +0x6c
github.com/newrelic/newrelic-cli/internal/client.WithClient(...)
/private/tmp/newrelic-cli-20200710-99399-1jjc2iq/newrelic-cli-0.10.0/internal/client/helpers.go:13
github.com/newrelic/newrelic-cli/internal/nrql.glob..func1(0x1a90e80, 0xc0000b1e60, 0x0, 0x6)
/private/tmp/newrelic-cli-20200710-99399-1jjc2iq/newrelic-cli-0.10.0/internal/nrql/command_query.go:31 +0x45
github.com/spf13/cobra.(*Command).execute(0x1a90e80, 0xc0000b1e00, 0x6, 0x6, 0x1a90e80, 0xc0000b1e00)
/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/[email protected]/command.go:846 +0x29d
github.com/spf13/cobra.(*Command).ExecuteC(0x1a928c0, 0x2, 0x0, 0x0)
/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/[email protected]/command.go:950 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
/Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/[email protected]/command.go:887
main.Execute(0xc000125f78, 0x100584f)
/private/tmp/newrelic-cli-20200710-99399-1jjc2iq/newrelic-cli-0.10.0/cmd/newrelic/command.go:35 +0xc1
main.main()
/private/tmp/newrelic-cli-20200710-99399-1jjc2iq/newrelic-cli-0.10.0/cmd/newrelic/main.go:41 +0x26