{"id":23838060,"url":"https://github.com/mochams/rebar3_go","last_synced_at":"2025-09-07T14:33:00.259Z","repository":{"id":269560034,"uuid":"907790281","full_name":"mochams/rebar3_go","owner":"mochams","description":"A rebar3 plugin that eases creating and building go ports in erlang projects","archived":false,"fork":false,"pushed_at":"2024-12-27T16:30:02.000Z","size":26,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-01-01T16:22:21.372Z","etag":null,"topics":["erlang","go","rebar3","rebar3-plugin"],"latest_commit_sha":null,"homepage":"https://hexdocs.pm/rebar3_go/","language":"Erlang","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mochams.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":"2024-12-24T11:51:05.000Z","updated_at":"2024-12-29T20:40:59.000Z","dependencies_parsed_at":"2024-12-24T12:54:52.909Z","dependency_job_id":"fb8fd535-73a9-4a2e-9c41-e13e6e7d3610","html_url":"https://github.com/mochams/rebar3_go","commit_stats":null,"previous_names":["mochams/rebar3_go"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochams%2Frebar3_go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochams%2Frebar3_go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochams%2Frebar3_go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mochams%2Frebar3_go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mochams","download_url":"https://codeload.github.com/mochams/rebar3_go/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232221034,"owners_count":18490716,"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":["erlang","go","rebar3","rebar3-plugin"],"created_at":"2025-01-02T16:26:06.074Z","updated_at":"2025-01-02T16:26:06.853Z","avatar_url":"https://github.com/mochams.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rebar3_go 🚀\n\n[![Erlang/OTP Versions](https://img.shields.io/badge/erlang%2Fotp-27-blue)](http://www.erlang.org)\n[![Hex Version](https://img.shields.io/hexpm/v/rebar3_go\n)](https://hex.pm/packages/rebar3_go)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/rebar3_go/)\n[![License](https://img.shields.io/github/license/mochams/rebar3_go)](https://github.com/mochams/rebar3_go)\n\nA rebar3 plugin for managing Go modules in Erlang/OTP applications.\n\n## Features\n\n- Adds Go modules to your Erlang/OTP project\n- Compiles Go modules in your project\n- Formats Go code in your project\n- Tests Go modules in your project\n- Supports standalone and release/umbrella applications\n- Minimal configuration required\n\n## Requirements\n\n- Erlang/OTP\n- Go\n\n## Installation\n\n```erlang\n%% Add the following to your rebar.config. \n{project_plugins, [rebar3_go]}.\n\n%% Optional: Add the following to your rebar.config\n{provider_hooks, [\n    {pre, [\n        {compile, {go, compile}}\n    ]}\n]}.\n```\n\n## Usage\n\n```bash\n# To add a Go module to your project (Standalone applications)\nrebar3 go add -m \u003cmodule_name\u003e\n\n# To add a Go module to your project (Release/Umbrella applications)\nrebar3 go add -m \u003cmodule_name\u003e -a \u003capp_name\u003e\n\n# To compile go modules\nrebar3 go compile\n\n# To format go code\nrebar3 go fmt\n\n# To test go modules\nrebar3 go test\n```\n\n## Directory Structure\n\n### Standalone App\n\n```bash\n.\n├── src                 # Erlang source code    \n├── go.work             # Go workspace definition\n├── go_src              # Go source code\n│   ├── module1         # Go module 1\n│   │   ├── main.go\n│   │   └── go.mod\n│   └── module2         # Go module 2\n│       ├── main.go\n│       └── go.mod\n├── priv                # Priv directory\n│   └── go              # Compiled Go code\n│       ├── module1     # Compiled Go module 1\n│       └── module2     # Compiled Go module 2\n```\n\n### Release/Umbrella App\n\n```bash\n.\n├── apps\n│   ├── app1                    # App 1\n│   │   ├── src                 # Erlang source code\n│   │   ├── go.work             # Go workspace definition\n│   │   ├── go_src              # Go source code\n│   │   │   ├── module1         # Go module 1\n│   │   │   │   ├── main.go\n│   │   │   │   └── go.mod\n│   │   │   └── module2         # Go module 2\n│   │   │       ├── main.go\n│   │   │       └── go.mod\n│   │   └── priv                # Priv directory\n│   │       └── go              # Compiled Go code\n│   │           ├── module1     # Compiled Go module 1\n│   │           └── module2     # Compiled Go module 2\n│   └── app2                    # App 2\n│       ├── src                 # Erlang source code\n│       ├── go.work             # Go workspace definition\n│       ├── go_src              # Go source code\n│       │   ├── module1         # Go module 1\n│       │   │   ├── main.go\n│       │   │   └── go.mod\n│       │   └── module2         # Go module 2\n│       │       ├── main.go\n│       │       └── go.mod\n│       └── priv                # Priv directory\n│           └── go              # Compiled Go code\n│               ├── module1     # Compiled Go module 1\n│               └── module2     # Compiled Go module 2\n└── rebar.config\n```\n\n## Commands\n\n### Add Module Command\n\n0. The plugin adds a Go module to the project.\n\n    `Syntax(Standalone app)`\n\n    ```bash\n    rebar3 go add -m \u003cmodule_name\u003e\n    ```\n\n    `Syntax(Release/Umbrella app)`\n\n    ```bash\n    rebar3 go add -m \u003cmodule_name\u003e -a \u003capp_name\u003e\n    ```\n\n1. First time adding a Go module to your project, the plugin creates a `go.work` file in the app root directory.\n\n    \u003e In standalone applications, the `go.work` file will be created in the root directory of the application.  \n    \u003e In release/umbrella applications, the `go.work` file will be created in the root directory of the specified app.\n\n2. The plugin creates a `go_src/\u003cmodule_name\u003e` directory and creates the `main.go` and `go.mod` files in it.\n\n3. The plugin adds the module name to the `go.work` file.\n\n### Compile Command\n\n0. The plugin compiles the Go modules in the project.\n\n    `Syntax`\n\n    ```bash\n    rebar3 go compile\n    ```\n\n1. The plugins goes through all applications in the project and checks if they have a `go_src` directory.\n\n2. If a `go_src` directory is found, the plugin compiles the Go module(s) in the directory else it skips the application.\n\n3. The plugin compiles the Go module(s) and copies the compiled code to the `priv/go` directory.\n\n### Format Command\n\n0. The plugin formats the Go code in the project.\n\n    `Syntax`\n\n    ```bash\n    rebar3 go fmt\n    ```\n\n1. The plugin runs the command `go fmt ./...` in each go module.\n\n### Test Command\n\n0. The plugin tests the Go modules in the project.\n\n    `Syntax`\n\n    ```bash\n    rebar3 go test\n    ```\n\n1. The plugin runs the command `go test ./... -cover` in each go module.\n\n2. The plugin aborts the whole operation if any of the tests fail.\n\n## Roadmap\n\n- [x] Add module command\n- [x] Compile command\n- [x] Format command\n- [x] Test module command\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Acknowledgments\n\nInspired by the needs of the Erlang/OTP community for reliable Go port communication.\n\n## Complementary Libraries\n\n- [Erlgo](https://github.com/mochams/erlgo): Send and Receive messages between Erlang and Go.\n\nNow go forth and make your Erlang and Go code talk to each other like old friends! 🚀✨\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmochams%2Frebar3_go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmochams%2Frebar3_go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmochams%2Frebar3_go/lists"}