{"id":21619094,"url":"https://github.com/bannzai/switchecker","last_synced_at":"2025-10-12T08:05:31.261Z","repository":{"id":57510287,"uuid":"235845160","full_name":"bannzai/switchecker","owner":"bannzai","description":"switchecker is tool of checking for missing switch case about go enum","archived":false,"fork":false,"pushed_at":"2022-12-21T11:56:41.000Z","size":101,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-19T08:27:13.934Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bannzai.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":"2020-01-23T17:12:43.000Z","updated_at":"2024-08-14T13:30:41.000Z","dependencies_parsed_at":"2023-01-30T03:30:37.038Z","dependency_job_id":null,"html_url":"https://github.com/bannzai/switchecker","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bannzai/switchecker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannzai%2Fswitchecker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannzai%2Fswitchecker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannzai%2Fswitchecker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannzai%2Fswitchecker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bannzai","download_url":"https://codeload.github.com/bannzai/switchecker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bannzai%2Fswitchecker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267117279,"owners_count":24038641,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2024-11-24T23:07:52.876Z","updated_at":"2025-10-12T08:05:26.218Z","avatar_url":"https://github.com/bannzai.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# switchecker\nswitchecker is tool of checking for missing switch case about go enum(Actually, this is not enum. It is constant value) in go file.\nIt can be take safety when using `switch` word in go source code.\nIt is ignore for dirty `case` (e.g case 5, case \"strings\"). \nSo, switcher only support to check the missing `case` and global definition value.\n\n## Install\n```bash\ngo get github.com/bannzai/switchecker\n```\n\n## Usage\n\n```bash\n$ switchecker --help\nUsage of switchecker:\n-source string\n\tSource go files are containing enum definition. Multiple specifications can be specified separated by ,. e.g) *.go,pkg/**/*.go  (default \"*.go\")\n-target string\n\tTarget go files are containing to use enum. Multiple specifications can be specified separated by ,. e.g) *.go,pkg/**/*.go  (default \"*.go\")\n-verbose\n\tEnabled verbose log\n```\n\n### Example \n#### Valid pattern\nAssuming go file exists. It has enum and call this enum.\n\n```go\npackage main\n\ntype language int\n\nconst (\n\tgolang language = iota\n\tswift\n)\n\nfunc main() {\n\tlang := golang\n\tswitch lang {\n\tcase golang:\n\t\tprintln(\"golang\")\n\tcase swift:\n\t\tprintln(\"swift\")\n\tdefault:\n\t\tprintln(\"default\")\n\t}\n}\n```\n\nThen try running **switchecker**.\n```bash\n$ switchecker -source=main.go -target=main.go\nSuccesfull!! $ switchecker -source=main.go -target=main.go\n```\nOutput Succesfull!! and actually execute command to console when go file is valid :tada: \n\n#### Invalid pattern\nNext example is invalid pattern about **switchecker**.\nCommentout for `case swift`.\n```go\npackage main\n\ntype language int\n\nconst (\n\tgolang language = iota\n\tswift\n)\n\nfunc main() {\n\tlang := golang\n\tswitch lang {\n\tcase golang:\n\t\tprintln(\"golang\")\n//\tcase swift:\n//\t\tprintln(\"swift\")\n\tdefault:\n\t\tprintln(\"default\")\n\t}\n}\n```\n\nAnd exec **switchecker**.\n```bash\n$ switchecker -source=main.go -target=main.go\n2020/02/02 01:18:08 missing enum pattern for main.language.swift. at /Users/bannzai/go/src/github.com/bannzai/switchecker/example/multipy_file/main.go:12:107\n```\n\nWhen input go file exists missing switch case, you got error information.\n\nIf you want to use **switchecker** immediately, [see more example, and play it](https://github.com/bannzai/switchecker/tree/master/example).\n\n## LICENSE\n**switchecker** is available under the MIT license. See the LICENSE file for more info.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbannzai%2Fswitchecker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbannzai%2Fswitchecker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbannzai%2Fswitchecker/lists"}