gremlin-go requires Golang 1.17 or later, please see Go Download for more details on installing Golang.To install the Gremlin-Go as a dependency for your project, run the following in the root directory of your project that contains your go.mod file:
go get github.com/apache/tinkerpop/gremlin-go/v3[optionally append @<version>, such as @v3.5.3 - note this requires GO111MODULE=on]
Available versions can be found at pkg.go.dev.
After running the go get command, your go.mod file should contain something similar to the following:
module gremlin-go-example go 1.17 require github.com/apache/tinkerpop/gremlin-go/v3 v<version>
If it does, then this means Gremlin-Go was successfully installed as a dependency of your project.
You will need to run go mod tidy to import the remaining dependencies of the gremlin-go driver (if your IDE does not do so automatically), after which you should see an updated go.mod file:
module gremlin-go-example go 1.17 require github.com/apache/tinkerpop/gremlin-go v0.0.0-20220131225152-54920637bf94 require ( github.com/google/uuid v1.3.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/nicksnyder/go-i18n/v2 v2.1.2 // indirect golang.org/x/text v0.3.7 // indirect )
As well as a populated go.sum file.
if there are no usages for gremlingo found, it will remove the require from go.mod and not import dependencies.
For instructions on simple usage, including connecting, connection settings, aliases and more, check out the Gremlin-Go section in the Tinkerpop Documentation.
wss should be used.readBufferSize.See Gremlin-Go Design Overview
To build the driver you must install go. The following command can be used to build the driver: go build <path to source code>
Before generating a pull request, you should manually run the following to ensure correct code styling and fix any issues indicated by the linters.
To ensure clean and readable code Gofmt is used.
Navigate to file path in a terminal window and run:
go fmt
Gofmt will recursively check for and format .go files.
Note: If your IDE of choice is GoLand, code can be automatically formatted with Gofmt on file save. Instructions on how to enable this feature can be found here.
Run go vet and staticcheck and correct any errors.
go vet is installed when you install go, and can be run with:
go vet <path to source code>
Please review the staticcheck documentation for more details on installing staticcheck. It can be run with:
staticcheck <path to source code>
Docker allows you to test the driver without installing any dependencies. Please make sure Docker is installed and running on your system. You will need to install both Docker Engine and Docker Compose, which are included in Docker Desktop.
The docker compose environment variable GREMLIN_SERVER specifies the Gremlin server docker image to use, i.e. an image with the tag tinkerpop/gremlin-server:$GREMLIN_SERVER, and is a required environment variable. This also requires the specified docker image to exist, either locally or in Docker Hub.
If your OS Platform cannot build a local SNAPSHOT Gremlin server through maven, it is recommended to use the latest released server version from Docker Hub (do not use GREMLIN_SERVER=latest, use actual version number, e.g. GREMLIN_SERVER=3.5.x or GREMLIN_SERVER=3.6.x).
There are 4 ways to launch the test suite and set the GREMLIN_SERVER environment variable depending on your Platform:
run.sh script, which sets GREMLIN_SERVER by default. Run ./run.sh -h for usage information (Unix/Linux - recommended).GREMLIN_SERVER=<server-image-version> to an .env file inside gremlin-go and run docker-compose up --exit-code-from gremlin-go-integration-tests (Platform-agnostic).GREMLIN_SERVER=<server-image-version> docker-compose up --exit-code-from gremlin-go-integration-tests in Unix/Linux.$env:GREMLIN_SERVER="<server-image-version>";docker-compose up --exit-code-from gremlin-go-integration-tests in Windows PowerShell.You should see exit code 0 upon successful completion of the test suites. Run docker-compose down to remove the service containers (not needed if you executed run.sh), or docker-compose down --rmi all to remove the service containers while deleting all used images.