Golang SDK - Logger doesn't load the error definition file

88 views
Skip to first unread message

remi.p...@gmail.com

unread,
Sep 19, 2022, 4:11:43 AM9/19/22
to Gremlin-users
Hey,
I've been trying out the Go SDK here: https://github.com/apache/tinkerpop/tree/3.6.1/gremlin-go

It's working great with the exception of logs going all over the place:
`  "msg": "%!(EXTRA string=ws://localhost:50639/gremlin)",`
the formating string is always empty.

I traced it back to this:
`path = filepath.Join(filepath.Dir(path), "resources/logger-messages/en.json")`

When this is called: `    bundle.LoadMessageFile(path)` it's actually trying to load the error messages from the package path at runtime (with bazel, it looks like this: `external/com_github_apache_tinkerpop_gremlin_go_v3/driver/resources/logger-messages/en.json`)
The file doesn't get loaded, and error from the function is ignored. No error returned as we don't get the source when we run the app so the messages are not formatted correctly.

This could be fixed by using something like bindata (https://github.com/go-bindata/go-bindata) to load the default language (en.json) alongside the lib.

I'm happy to submit a PR for this if that's an acceptable approach to solving this.

Thanks!
Remi

Valentyn Kahamlyk

unread,
Sep 27, 2022, 7:01:00 PM9/27/22
to Gremlin-users
Hi Remi,

I tried to reproduce this issue with a fresh gremlin-go 3.6.1 and the code
`import (
    "fmt"
    gremlingo "github.com/apache/tinkerpop/gremlin-go/v3/driver"
)

func main() {
    client, err := gremlingo.NewClient("ws://wrong-host:8182/gremlin")
    _, err = client.Submit("g.V().count()")
    fmt.Println(err)
}`
but I got correct error message in logs.
"Error occurred during operation NewClient: 'E0104: no successful connections could be made: dial tcp: lookup wrong-host: no such host"

Could you share code Snippet for reproducing this error?

Additionally, feel free to open PRs to contribute, thank you!

remi.p...@gmail.com

unread,
Oct 17, 2022, 8:12:22 AM10/17/22
to Gremlin-users
Sorry for the late reply, I pushed the following PR: https://github.com/apache/tinkerpop/pull/1829

To reproduce, build a binary and run the binary in a container that doesn't have the source repo, that seems to work everytime. With the PR I proposed, I don't see the issue anymore, hope it helps!

Reply all
Reply to author
Forward
0 new messages