{"id":13563996,"url":"https://github.com/letiantech/hotplugin","last_synced_at":"2025-03-20T08:28:00.028Z","repository":{"id":22433034,"uuid":"96234858","full_name":"letiantech/hotplugin","owner":"letiantech","description":"golang plugin framework for hot update","archived":false,"fork":false,"pushed_at":"2022-01-08T12:58:49.000Z","size":22,"stargazers_count":39,"open_issues_count":0,"forks_count":5,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-04T16:46:02.707Z","etag":null,"topics":["framework","golang","golang-library","hot-update","plugin"],"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/letiantech.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":"2017-07-04T16:05:47.000Z","updated_at":"2024-05-05T12:40:59.000Z","dependencies_parsed_at":"2022-08-25T20:11:20.726Z","dependency_job_id":null,"html_url":"https://github.com/letiantech/hotplugin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letiantech%2Fhotplugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letiantech%2Fhotplugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letiantech%2Fhotplugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/letiantech%2Fhotplugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/letiantech","download_url":"https://codeload.github.com/letiantech/hotplugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244577087,"owners_count":20475242,"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":["framework","golang","golang-library","hot-update","plugin"],"created_at":"2024-08-01T13:01:25.369Z","updated_at":"2025-03-20T08:28:00.007Z","avatar_url":"https://github.com/letiantech.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/letiantech/hotplugin.svg)](https://travis-ci.org/letiantech/hotplugin)\n\n# hotplugin\ngolang plugin framework for hot update, go version \u003e= 1.8\n\n# usage\n1. get hotplugin\n```bash\ngo get github.com/letiantech/hotplugin\n```\n2. write a plugin with Load, Unload and other functions like this\n```go\n//testplugin.go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n)\n\nconst (\n\tpluginName    = \"testplugin\"\n\tpluginVersion = 0x00010000\n)\n\nfunc Load(register func(name string, version uint64) error) error {\n\terr := register(pluginName, pluginVersion)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\treturn err\n\t}\n\tlog.Println(\"loading test plugin\")\n\treturn nil\n}\n\nfunc Unload() error {\n\tfmt.Printf(\"unload %s, version: 0x%x\\n\", pluginName, pluginVersion)\n\treturn nil\n}\n\nfunc Test(data string) string {\n\treturn \"hello \" + data\n}\n```\n\n3. build your plugin\n```bash\ngo build -buildmode=plugin ./testplugin.go\n```\n\n4. save your testplugin.so to /path/of/plugin/dir\n\n5. write main.go like this\n```go\n//main.go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/letiantech/hotplugin\"\n)\n\nfunc main() {\n\toptions := hotplugin.ManagerOptions{\n\t\tDir:    \"./\",\n\t\tSuffix: \".so\",\n\t}\n\thotplugin.StartManager(options)\n\tresult := hotplugin.Call(\"testplugin\", \"Test\", \"my world\")\n\tfmt.Println(result...)\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletiantech%2Fhotplugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fletiantech%2Fhotplugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fletiantech%2Fhotplugin/lists"}