{"id":37197133,"url":"https://github.com/xellio/golang-plugin-example","last_synced_at":"2026-01-14T22:55:28.542Z","repository":{"id":57567615,"uuid":"157885726","full_name":"xellio/golang-plugin-example","owner":"xellio","description":"golang plugin example","archived":false,"fork":false,"pushed_at":"2018-11-19T09:33:17.000Z","size":5,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-19T20:51:49.308Z","etag":null,"topics":["go","golang","plugin-loader"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/xellio.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}},"created_at":"2018-11-16T15:26:29.000Z","updated_at":"2024-06-19T20:51:49.309Z","dependencies_parsed_at":"2022-08-28T10:01:14.241Z","dependency_job_id":null,"html_url":"https://github.com/xellio/golang-plugin-example","commit_stats":null,"previous_names":["xellio/modules"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xellio/golang-plugin-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xellio%2Fgolang-plugin-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xellio%2Fgolang-plugin-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xellio%2Fgolang-plugin-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xellio%2Fgolang-plugin-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xellio","download_url":"https://codeload.github.com/xellio/golang-plugin-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xellio%2Fgolang-plugin-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28437311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","golang","plugin-loader"],"created_at":"2026-01-14T22:55:26.334Z","updated_at":"2026-01-14T22:55:28.321Z","avatar_url":"https://github.com/xellio.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## GO Plugins example \n\nA small example application for using plugins in go.  \nUsing plugins, it is possible to add/remove functionality to a compiled go program at runtime.\n\nIn this example, I expect that a plugin has a function New (see: cmd/cli/main.go +29).  \nI also expect that the return value of this New function implements a Module interface (see: pkg/wrapper/module.go). In this application, a Module has needs a fuction called Execute().  \nIf you want to create a new plugin for this application, you have to implement those two functions at a minimum.  \n\n### Example:\nClone and build the example application:\n```\ngo get -u github.com/xellio/golang-plugin-example\ncd $GOPATH/src/github.com/xellio/golang-plugin-example/\nmake\n```\n\nRun the application:\n```\n./bin/modules\n\nHello from FIRST...\nHello from SECOND...\nHello from THIRD - Written in C...\n\nHello from FIRST...\nHello from THIRD - Written in C...\nHello from SECOND...\n\nHello from FIRST...\nHello from SECOND...\nHello from THIRD - Written in C...\n...\n```\n***NOTE:*** In this example, the plugins were executed in a goroutine - so the order of the output can change.\n\nIn the application root ($GOPATH/src/github.com/xellio/golang-plugin-example/)  you will find a plugins/ directory, conaining the loaded plugins (.so files):\n```\n...\n├── plugins\n│   ├── first_plugin.so\n│   ├── second_plugin.so\n│   └── third_plugin.so\n...\n```\nRemoving one of those plugins **while running the application** will stop executing the removed plugin:\n\n```\nmv ./plugins/second_plugin.so .\n```\nOutput:\n```\nHello from FIRST...\nHello from THIRD - Written in C...\nHello from SECOND...\n\nHello from THIRD - Written in C...\nHello from FIRST...\n\nHello from FIRST...\nHello from THIRD - Written in C...\n\nHello from THIRD - Written in C...\nHello from FIRST...\n\n```\n\n(Re)adding a plugin to the plugins/ directory will (re)execute the plugin:\n```\nmv ./second_plugin.so ./plugins/\n```\nOutput:\n```\nHello from THIRD - Written in C...\nHello from FIRST...\n\nHello from FIRST...\nHello from THIRD - Written in C...\nHello from SECOND...\n\nHello from FIRST...\nHello from THIRD - Written in C...\nHello from SECOND...\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxellio%2Fgolang-plugin-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxellio%2Fgolang-plugin-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxellio%2Fgolang-plugin-example/lists"}