Skip to content

The Command Line Tool

The gd command can be installed using go install, this command is a drop in replacement for the go command for working with graphics.gd projects.

Terminal window
go install graphics.gd/cmd/gd@release
Terminal window
gd # launch the Godot editor to manage assets and design the UI.
gd run # run the project in debug mode.
gd build # export the project as a release depending upon GOOS and GOARCH.
gd test # run your Go tests.

The gd command takes care of all the build flags and configuration files needed to setup Go + Godot so that things will “just work” in the same way that the go command does.

If you are already well versed in Godot and GDExtension, or you want to use your own build tools, you can use the go command to build the shared library yourself:

Terminal window
CC="zig cc" go build -o example.so -buildmode=c-shared

Everything you would have to setup for yourself if you were using go directly:

  • downloads and runs Godot for you on supported platforms.
  • creates a graphics directory to house the godot project.
  • creates a blank project.godot and main.tscn.
  • creates the .gdextension library and enables it.
  • outputs Go binaries into the graphics directory.
  • sets up a .gitignore to ignore these compiled Go libraries.
  • creates export presets that export into releases.
  • sets the correct zig flags when cross-compiling.
  • uses vpk to bundle the project into a self-updating release.
  • sets up Go tests to run correctly within the Godot runtime.