{"id":36455675,"url":"https://github.com/vitrun/sanus","last_synced_at":"2026-01-11T23:03:08.702Z","repository":{"id":57595977,"uuid":"285605181","full_name":"vitrun/sanus","owner":"vitrun","description":"A collection of Go Vet-style linters to make programs sound and healthy","archived":false,"fork":false,"pushed_at":"2020-08-07T07:22:04.000Z","size":7,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T05:20:44.014Z","etag":null,"topics":["analysis","go","golang","vet"],"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/vitrun.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-08-06T15:23:42.000Z","updated_at":"2024-06-20T05:20:44.014Z","dependencies_parsed_at":"2022-09-26T20:01:21.879Z","dependency_job_id":null,"html_url":"https://github.com/vitrun/sanus","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vitrun/sanus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitrun%2Fsanus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitrun%2Fsanus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitrun%2Fsanus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitrun%2Fsanus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitrun","download_url":"https://codeload.github.com/vitrun/sanus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitrun%2Fsanus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28326166,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T22:11:01.104Z","status":"ssl_error","status_checked_at":"2026-01-11T22:10:58.990Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["analysis","go","golang","vet"],"created_at":"2026-01-11T23:03:08.166Z","updated_at":"2026-01-11T23:03:08.697Z","avatar_url":"https://github.com/vitrun.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SANUS\n\n[![build](https://github.com/vitrun/sanus/workflows/build/badge.svg)](https://github.com/vitrun/sanus/actions/)\n[![Go Report Card](https://goreportcard.com/badge/github.com/vitrun/sanus)](https://goreportcard.com/report/github.com/vitrun/sanus)\n\nA collection of Go Vet-style linters to make program sanus ([ˈsaː.nus], sound in body, healthy; sound in mind, sane).\n- panicable. Check for possible panics that would result in program exit.\n\n## Panicable\n\n`Panicable` finds goroutines that have no `defer` or `recover` statements. Once they panic, not necessarily though, the whole program is endangered.\n\n\nThese patterns while be identified:\n\n**pattern 1**\n```go\nfunc main() {\n\tgo func() {  // no defer\n\t\tpanic(\"I'm paniced\")\n\t}()\n}\n```\n\n**pattern 2**\n```go\nfunc a() {\n\tgo func() { // no recover\n\t\tdefer func() {\n\t\t}()\n    panic(\"doomed\")\n\t}()\n}\n```\n\nMethods are supported:\n```go\ntype S struct{}\n\nfunc (s *S) foo() {\n\tgo func() { // no defer\n\t\tprintln(\"foo\")\n\t}()\n}\n```\n\n## Install\n\nSpecify the cmd to install, `panicable` for example:\n\n```\ngo get github.com/vitrun/sanus/cmd/panicable\n```\n\nThis will install `panicable` to `$GOPATH/bin`, so make sure that it is included in your `$PATH` environment variable.\n\n\n## Usage\n\nRun cmd on current package like this:\n\n```\n$ panicable .\n```\n\nOr supply multiple packages, separated by spaces:\n\n```\n$ panicable example/cmd example/util strings\n```\n\nTo check a package and, recursively, all its imports, use `./...`:\n\n```\n$ panicable net/...\n```\n\nall cmds in sanus accept the same flags as `go vet`:\n\n```\nFlags:\n  -V    print version and exit\n  -c int\n        display offending line with this many lines of context (default -1)\n  -cpuprofile string\n        write CPU profile to this file\n  -debug string\n        debug flags, any subset of \"fpstv\"\n  -fix\n        apply all suggested fixes\n  -flags\n        print analyzer flags in JSON\n  -json\n        emit JSON output\n  -memprofile string\n        write memory profile to this file\n  -trace string\n        write trace log to this file\n```\n\n## Development\n\nTo get the source code and compile/test specific cmd, run this:\n\n```\n$ git clone https://github.com/vitrun/sanus\n$ cd sanus/panicable\n$ go build -o panicable ./cmd/panicable\n$ go test -v\n```\n\n`sanus` uses the testing infrastructure from `golang.org/x/tools/go/analysis/analysistest`. To add a test case, add new package in related `testdata/src`. \n\nIn the test case source files, add annotation comments to the lines that should be reported (or not). The comments must\nlook like this:\n\n```\nfunc main() {\n\tgo func() {  // want \"no defer\"\n\t\tpanic(\"I'm paniced\")\n\t}()\n}\n```\n\nAnnotations that indicate a line that should be reported must begin with a `want` followed by the desired message .\n\nSince `sanus` is built upon the Go Vet standard infrastructure, you can import the passes into your own Go Vet-based linter.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitrun%2Fsanus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitrun%2Fsanus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitrun%2Fsanus/lists"}