{"id":19220422,"url":"https://github.com/louisbrunner/go-dot-extension","last_synced_at":"2026-05-06T08:35:07.017Z","repository":{"id":235616096,"uuid":"728234142","full_name":"LouisBrunner/go-dot-extension","owner":"LouisBrunner","description":"Godot extension for Golang","archived":false,"fork":false,"pushed_at":"2024-05-18T15:04:55.000Z","size":6796,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-04T19:43:33.951Z","etag":null,"topics":["go","godot","godot4","golang"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LouisBrunner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-06T14:09:21.000Z","updated_at":"2024-04-23T23:18:38.000Z","dependencies_parsed_at":"2024-05-18T16:24:28.789Z","dependency_job_id":"51ef21df-4d1c-459c-ad91-00fa9214f4bd","html_url":"https://github.com/LouisBrunner/go-dot-extension","commit_stats":null,"previous_names":["louisbrunner/go-dot-extension"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisBrunner%2Fgo-dot-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisBrunner%2Fgo-dot-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisBrunner%2Fgo-dot-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LouisBrunner%2Fgo-dot-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LouisBrunner","download_url":"https://codeload.github.com/LouisBrunner/go-dot-extension/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240293471,"owners_count":19778521,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","godot","godot4","golang"],"created_at":"2024-11-09T14:35:06.184Z","updated_at":"2026-05-06T08:35:01.969Z","avatar_url":"https://github.com/LouisBrunner.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-dot-extension\n\n**WARNING: This project is still in early development and the API might break frequently.**\n\nThis project allows you to create a Godot extension in Go.\n\nThe API is heavily inspired by https://github.com/ShadowApex/godot-go.\n\n## Usage\n\nIn order to use Go in your Godot project, you need to compile the Go code into a shared library and load it in Godot.\nThis is done by using the Go `-buildmode=c-shared` flag on a `main` package with a `main` function.\n\n### Boilerplate code\n\nCreate a go file containing the following:\n\n```go\npackage main\n\nfunc init() {\n}\n\nfunc main() {\n}\n```\n\nWe will be using the `init` function to register our custom Godot classes, implemented in Go.\n\n## Create a custom Godot class\n\nA basic Godot class is defined as a struct with an embbeded `gdapi` struct. For example, to inherit from `Node2D`:\n\n```go\ntype MyNode2D struct {\n  gdapi.Node2D\n}\n```\n\nAny public method receiver defined on `MyNode2D` will be available as a method on the Godot class and any public field will be available as a property.\n\n```go\ntype MyNode2D struct {\n  gdapi.Node2D\n\n  Speed int\n}\n\nfunc (n *MyNode2D) Move(vec gdapi.Vector2) {\n  Node2D.SetPosition(vec.MulScalar(n.Speed))\n}\n```\n\n## Register the custom Godot class\n\nIn the `init` function, register the custom Godot class:\n\n```go\npackage main\n\nimport (\n  gde \"github.com/LouisBrunner/go-dot-extension\"\n)\n\nfunc NewMyNode2D() gde.Class {\n  return \u0026MyNode2D{}\n}\n\nfunc init() {\n  gde.Register(NewMyNode2D)\n}\n\nfunc main() {\n}\n```\n\n### Compiling the shared library\n\nYour package is now ready to be built as a shared library.\n\n```bash\n# Linux\ngo build -buildmode=c-shared -o libmyextension.so pkg_folder\n# macOS\ngo build -buildmode=c-shared -o libmyextension.dylib pkg_folder\n# Windows\ngo build -buildmode=c-shared -o libmyextension.dll pkg_folder\n```\n\nYou can name the shared library whatever you want, the example above uses `libmyextension`.\n\n### How to write your class\n\nHere are some notes on how to write your class:\n\n- Any exported method will be available as a method on the Godot class (apart from any function called `Destroy`)\n- Any exported field will be available as a property on the Godot class (apart from any with type `gdextension.Signal` or `gdapi.SignalSubscribers`)\n- Any method starting with `X_` will be assumed to be a virtual method (e.g. `X_Ready` for `_ready`)\n- All methods and fields will be exported as `snake_case` (e.g. `MyMethod` will be `my_method`), this might lead to name conflicts, so make sure to use unique names\n- All exported methods must have 1 or no return value, multiple return values are not supported\n- Any exported property which is a `gdapi.Object` (basically anything from `gdapi`) will be automatically initialized for you, if it is a pointer however, you will need to initialize it yourself\n- Any `gdapi.SignalSubscribers` field will be automatically initialized for you, even if its not exported, as stated above, it must be a field and not a pointer however\n\n### Including the shared library in Godot\n\nYou will need to create a file with the extension `.gdextension` and place it in your project for Godot to be able to load the shared library.\n\n```gdscript\n[configuration]\nentry_symbol = \"go_dot_gdextension_entry\"\ncompatibility_minimum = \"4.1\"\n\n[libraries]\nmacos.debug.arm64 = \"res://your_folder/libmyextension-darwin-arm64.dylib\"\nmacos.release.arm64 = \"res://your_folder/libmyextension-darwin-arm64.dylib\"\nmacos.debug.amd64 = \"res://your_folder/libmyextension-darwin-amd64.dylib\"\nmacos.release.amd64 = \"res://your_folder/libmyextension-darwin-amd64.dylib\"\nwindows.debug.amd64 = \"res://your_folder/libmyextension-windows-amd64.dll\"\nwindows.release.amd64 = \"res://your_folder/libmyextension-windows-amd64.dll\"\nlinux.debug.amd64 = \"res://your_folder/libmyextension-linux-amd64.so\"\nlinux.release.amd64 = \"res://your_folder/libmyextension-linux-amd64.so\"\n```\n\nYou will need to replace `your_folder` with the path to the folder containing the shared library and `libmyextension` with the name of the shared library.\n\n### Examples\n\nYou can find examples in the `examples` folder.\n\n- `simple`: a simple example of a custom Godot class, which basically reproduces the above usage\n- `property-getset`: an example of how to use getter and setter for your properties\n- `signals`: an example of how to use signals\n- `gdscript`: an example of how to use the custom Godot class in GDScript\n\n## Issues\n\n- cannot connect to signals from within Go (do it from GDScript/the editor directly)\n- the extension will exit the whole program when unloaded, otherwise it will just crash (most likely SIGSEGV)\n- `Signal`s have no arguments in the Godot documentation/type hint system\n\n## Acknowledgements\n\n- https://github.com/ShadowApex/godot-go: for their great work and straight-forward API which inspired this project\n\n## See also\n\n- https://github.com/godot-go/godot-go: more mature project with a similar goal\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouisbrunner%2Fgo-dot-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flouisbrunner%2Fgo-dot-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flouisbrunner%2Fgo-dot-extension/lists"}