Despite being go getable, GDNative-Go needs a few extra steps in order to install it successfully but worry not, the process is pretty straightforward, first get the library and cd into it:
go get -u gitlab.com/pimpam-games-studio/gdnative-go
cd $GOPATH/src/gitlab.com/pimpam-games-studio/gdnative-go
Initialize the git submodule to get the Godot’s godot-headers
source code
git submodule update --init --recursive
if you already have a copy gdnative-code and you want to update godot-headers
you should run git submodule foreach git pull origin master
instead
Now we need to generate the Go wrappers around NativeScript types using the generation script:
go run build/mage.go
The command above will:
Optionally you can also install the gogdc compiler utility to autoregister classes, GDNative-Go library supports boilerplate code auto generation in order to auto register classes within Godot. To create the compiler binary just run:
go run build/mage.go install
you will need to add the $GOPATH/bin
to your $PATH
to use the gogdc compiler in your projects