northwesternmutual / grammes

A Go package built to communicate with Apache TinkerPop™ Graph computing framework using Gremlin; a graph traversal language used by graph databases such as JanusGraph®, MS Cosmos DB, AWS Neptune, and DataStax® Enterprise Graph.
Apache License 2.0
125 stars 45 forks source link

errors not returned #6

Closed blackjune closed 4 years ago

blackjune commented 4 years ago

https://github.com/northwesternmutual/grammes/blob/master/response.go#L78

damienfamed75 commented 4 years ago

@blackjune do you mind explaining your issue? From what I can see the error is being returned. The loop on response.go#L77 looks fine to me.

for _, d := range dataI.([]interface{}) {
    if dataPart, err = jsonMarshalData(d); err != nil {
        return nil, err // L78: being returned
    }

    data = append(data, dataPart)
}
blackjune commented 4 years ago

when d is an error, d will be lost. when jsonMarshalData returns an error, where will be a memory leak

damienfamed75 commented 4 years ago

Hmmm... I see.

Do you mind making a pull request with those changes?