Skip to content

Commit

Permalink
Perform proper interface nil checking for fetch result. Closes #186
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidaguerre authored Oct 8, 2021
1 parent 23e1065 commit da96cd4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/olekukonko/tablewriter v0.0.4
github.com/sethvargo/go-retry v0.1.0
github.com/stevenle/topsort v0.0.0-20130922064739-8130c1d7596b
github.com/turbot/go-kit v0.2.2-0.20210628165333-268ba0a30be3
github.com/turbot/go-kit v0.3.0
github.com/zclconf/go-cty v1.8.2
google.golang.org/grpc v1.33.1
google.golang.org/protobuf v1.25.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tkrajina/go-reflector v0.5.4 h1:dS9aJEa/eYNQU/fwsb5CSiATOxcNyA/gG/A7a582D5s=
github.com/tkrajina/go-reflector v0.5.4/go.mod h1:9PyLgEOzc78ey/JmQQHbW8cQJ1oucLlNQsg8yFvkVk8=
github.com/turbot/go-kit v0.2.2-0.20210628165333-268ba0a30be3 h1:UAfWYp+K7oESlqomRus4k+h/dSPXU17tEcarbRdtBwQ=
github.com/turbot/go-kit v0.2.2-0.20210628165333-268ba0a30be3/go.mod h1:SBdPRngbEfYubiR81iAVtO43oPkg1+ASr+XxvgbH7/k=
github.com/turbot/go-kit v0.3.0 h1:o4zZIO1ovdmJ2bHWOdXnnt8jJMIDGqYSkZvBREzFeMQ=
github.com/turbot/go-kit v0.3.0/go.mod h1:SBdPRngbEfYubiR81iAVtO43oPkg1+ASr+XxvgbH7/k=
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
Expand Down
5 changes: 3 additions & 2 deletions plugin/table_fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/turbot/steampipe-plugin-sdk/logging"
"github.com/turbot/steampipe-plugin-sdk/plugin/context_key"
"github.com/turbot/steampipe-plugin-sdk/plugin/quals"

"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
)
Expand Down Expand Up @@ -165,7 +166,7 @@ func (t *Table) doGet(ctx context.Context, queryData *QueryData, hydrateItem int
}

// if there is no error and the getItem is nil, we assume the item does not exist
if getItem != nil {
if !helpers.IsNil(getItem) {
// set the rowData Item to the result of the Get hydrate call - this will be passed through to all other hydrate calls
rd.Item = getItem
// NOTE: explicitly set the get hydrate results on rowData
Expand Down Expand Up @@ -227,7 +228,7 @@ func (t *Table) getForEach(ctx context.Context, queryData *QueryData, rd *RowDat
if err != nil {
log.Printf("[TRACE] callHydrateWithRetries returned error %v", err)
errorChan <- err
} else if item != nil {
} else if !helpers.IsNil(item) {
// stream the get item AND the matrix item
resultChan <- &resultWithMetadata{item, matrixItem}
}
Expand Down

0 comments on commit da96cd4

Please sign in to comment.