{"id":42170572,"url":"https://github.com/xchapter7x/toggle","last_synced_at":"2026-01-26T21:26:48.150Z","repository":{"id":22075834,"uuid":"25405164","full_name":"xchapter7x/toggle","owner":"xchapter7x","description":"golang feature toggle library - a library to help make golang feature toggling clean and easy","archived":false,"fork":false,"pushed_at":"2015-10-17T17:19:37.000Z","size":608,"stargazers_count":23,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T03:35:44.622Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xchapter7x.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-18T17:57:18.000Z","updated_at":"2023-03-01T09:06:45.000Z","dependencies_parsed_at":"2022-08-19T04:50:21.538Z","dependency_job_id":null,"html_url":"https://github.com/xchapter7x/toggle","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/xchapter7x/toggle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xchapter7x%2Ftoggle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xchapter7x%2Ftoggle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xchapter7x%2Ftoggle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xchapter7x%2Ftoggle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xchapter7x","download_url":"https://codeload.github.com/xchapter7x/toggle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xchapter7x%2Ftoggle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28788370,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:13:08.818Z","status":"ssl_error","status_checked_at":"2026-01-26T21:13:08.448Z","response_time":59,"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":[],"created_at":"2026-01-26T21:26:47.117Z","updated_at":"2026-01-26T21:26:48.143Z","avatar_url":"https://github.com/xchapter7x.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"toggle\n======\n\n[![wercker status](https://app.wercker.com/status/9c11e691895a9782a234fcc9bb313819/m \"wercker status\")](https://app.wercker.com/project/bykey/9c11e691895a9782a234fcc9bb313819)\n\n[![GoDoc](http://godoc.org/github.com/xchapter7x/toggle?status.png)](http://godoc.org/github.com/xchapter7x/toggle)\n\n[![CoverageStatus](https://coveralls.io/repos/xchapter7x/toggle/badge.svg?branch=HEAD\u0026service=github)](https://coveralls.io/github/xchapter7x/toggle?branch=HEAD)\n\n## supports env_variable backed toggling. \n## It can also be updated via a pubsub interface (tested w/ redis)\n## 2 engines for toggle backing are included\n\t- Local Engine (only env variable backed)\n\t- Local Engine PubSub (env variable backed w/ updates via redis pubsub)\n\n## can be extended to support any 3rd party backing engine\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunc **Flip**(flg string, defaultFeature, newFeature interface{}, iargs ...interface{}) (responseInterfaceArray []interface{}) {}\n\n\nfunc **SetFeatureStatus**(featureSignature, featureStatus string) (err error) {}\n\nfunc **IsActive**(featureSignature string) (active bool) {}\n\nfunc **Close**() {}\n\nfunc **Init**(ns string, engine storageinterface.StorageEngine) {}\n\nfunc **ShowFeatures**() map[string]*Feature {}\n\nfunc **RegisterFeature**(featureSignature string) (err error) {}\n\nfunc **GetFullFeatureSignature**(partialSignature string) (fullSignature string) {}\n\nfunc **RegisterFeatureWithStatus**(featureSignature, statusValue string) (err error) {}\n\ntype Feature struct {\n\tname     string\n\tStatus   string\n\tfilter   func(...interface{}) bool\n\tsettings map[string]interface{}\n}\nfunc (s \\*Feature) **UpdateStatus**(newStatus string) {}\n\n\n\ntype **DefaultEngine** struct\n\nfunc (s \\*DefaultEngine) **GetFeatureStatusValue**(featureSignature string) (status string, err error)\n\n\nSample usage:\n(./sample/main.go)\n```\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/xchapter7x/goutil/unpack\"\n\t\"github.com/xchapter7x/toggle\"\n)\n\nfunc TestA(s string) (r string) {\n\tr = fmt.Sprintln(\"testa\", s)\n\tfmt.Println(r)\n\treturn\n}\n\nfunc TestB(s string) (r string) {\n\tr = fmt.Sprintln(\"testb\", s)\n\tfmt.Println(r)\n\treturn\n}\n\nfunc main() {\n\ttoggle.Init(\"MAINTEST\", nil)\n\ttoggle.RegisterFeature(\"test\")\n\toutput := \"\"\n\t_, err := tgl.Flag(\"test\").\n\t\t\tOn(testB).\n\t\t\tOff(testA).\n\t\t\tArgs(\"argstring\").\n\t\t\tReturns(\u0026output).\n\t\t\tRun()\n\tfmt.Println(output)\n}\n\n// or\n\nfunc mainAlt() {\n\ttoggle.Init(\"MAINTEST\", nil)\n\ttoggle.RegisterFeature(\"test\")\n\tf := toggle.Flip(\"test\", TestA, TestB, \"argstring\")\n\tvar output string\n\tunpack.Unpack(f, \u0026output)\n\tfmt.Println(output)\n\n}\n```\n\n\n```\n$ test=true go run sample/main.go\ntestb argstring\n\ntestb argstring\n\n\n\n$ go run sample/main.go\ntesta argstring\n\ntesta argstring\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxchapter7x%2Ftoggle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxchapter7x%2Ftoggle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxchapter7x%2Ftoggle/lists"}