{"id":13472108,"url":"https://github.com/kisielk/errcheck","last_synced_at":"2025-05-13T16:06:04.068Z","repository":{"id":7105348,"uuid":"8397993","full_name":"kisielk/errcheck","owner":"kisielk","description":"errcheck checks that you checked errors.","archived":false,"fork":false,"pushed_at":"2025-04-06T15:17:17.000Z","size":8481,"stargazers_count":2405,"open_issues_count":13,"forks_count":140,"subscribers_count":26,"default_branch":"master","last_synced_at":"2025-05-03T02:36:38.815Z","etag":null,"topics":["errcheck","error","go","linter"],"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/kisielk.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-02-24T22:32:02.000Z","updated_at":"2025-04-24T11:48:04.000Z","dependencies_parsed_at":"2025-04-22T05:06:40.822Z","dependency_job_id":"17cef6a0-b84a-4528-afe3-6516be87e85e","html_url":"https://github.com/kisielk/errcheck","commit_stats":{"total_commits":275,"total_committers":54,"mean_commits":5.092592592592593,"dds":0.6363636363636364,"last_synced_commit":"df44f751ca5b403ebfbb4876ef2c2ad61e08c3d0"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kisielk%2Ferrcheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kisielk%2Ferrcheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kisielk%2Ferrcheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kisielk%2Ferrcheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kisielk","download_url":"https://codeload.github.com/kisielk/errcheck/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252590526,"owners_count":21772935,"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":["errcheck","error","go","linter"],"created_at":"2024-07-31T16:00:51.979Z","updated_at":"2025-05-05T22:49:44.854Z","avatar_url":"https://github.com/kisielk.png","language":"Go","readme":"# errcheck\n\nerrcheck is a program for checking for unchecked errors in Go code.\n\n![errcheck](https://github.com/kisielk/errcheck/workflows/errcheck/badge.svg)\n\n## Install\n\n    go install github.com/kisielk/errcheck@latest\n\nerrcheck requires Go 1.22 or newer.\n\n## Use\n\nFor basic usage, just give the package path of interest as the first argument:\n\n    errcheck github.com/kisielk/errcheck/testdata\n\nTo check all packages beneath the current directory:\n\n    errcheck ./...\n\nOr check all packages in your `$GOPATH` and `$GOROOT`:\n\n    errcheck all\n\nerrcheck also recognizes the following command-line options:\n\nThe `-tags` flag takes a space-separated list of build tags, just like `go\nbuild`. If you are using any custom build tags in your code base, you may need\nto specify the relevant tags here.\n\nThe `-asserts` flag enables checking for ignored type assertion results. It\ntakes no arguments.\n\nThe `-blank` flag enables checking for assignments of errors to the\nblank identifier. It takes no arguments.\n\nThe `-abspath` flag prints the absolute paths to files with unchecked errors.\n\nThe `-mod` flag sets the module download mode to use: `readonly` or `vendor`.\n\n### go/analysis\n\nThe package provides `Analyzer` instance that can be used with\n[go/analysis](https://pkg.go.dev/golang.org/x/tools/go/analysis) API.\n\nCurrently supported flags are `blank`, `assert`, `exclude`, and `excludeonly`.\nJust as the API itself, the analyzer is experimental and may change in the\nfuture.\n\n## Excluding functions\n\nUse the `-exclude` flag to specify a path to a file containing a list of functions to\nbe excluded.\n\n    errcheck -exclude errcheck_excludes.txt path/to/package\n\nThe file should contain one function signature per line. The format for function signatures is\n`package.FunctionName` while for methods it's `(package.Receiver).MethodName` for value receivers\nand `(*package.Receiver).MethodName` for pointer receivers. If the function name is followed by string of form `(TYPE)`, then\nthe the function call is excluded only if the type of the first argument is `TYPE`. It also accepts a special suffix\n`(os.Stdout)` and `(os.Stderr)`, which excludes the function only when the first argument is a literal `os.Stdout` or `os.Stderr`.\n\nAn example of an exclude file is:\n\n    io.Copy(*bytes.Buffer)\n    io.Copy(os.Stdout)\n    os.ReadFile\n\n    // Sometimes we don't care if a HTTP request fails.\n    (*net/http.Client).Do\n\nBy default, the exclude list is combined with an internal list for functions in\nthe Go standard library that have an error return type but are documented to never\nreturn an error. To disable the built-in exclude list, pass the `-excludeonly` flag.\n\nRun errcheck in `-verbose` mode to see the resulting list of added excludes.\n\nWhen using vendored dependencies, specify the full import path. For example:\n* Your project's import path is `example.com/yourpkg`\n* You've vendored `example.net/fmt2` as `vendor/example.net/fmt2`\n* You want to exclude `fmt2.Println` from error checking\n\nIn this case, add this line to your exclude file:\n```\nexample.com/yourpkg/vendor/example.net/fmt2.Println\n```\n\nEmpty lines and lines starting with `//` are ignored.\n\n### The deprecated method\n\nThe `-ignore` flag takes a comma-separated list of pairs of the form package:regex.\nFor each package, the regex describes which functions to ignore within that package.\nThe package may be omitted to have the regex apply to all packages.\n\nFor example, you may wish to ignore common operations like Read and Write:\n\n    errcheck -ignore '[rR]ead|[wW]rite' path/to/package\n\nor you may wish to ignore common functions like the `print` variants in `fmt`:\n\n    errcheck -ignore 'fmt:[FS]?[Pp]rint*' path/to/package\n\nThe `-ignorepkg` flag takes a comma-separated list of package import paths\nto ignore:\n\n    errcheck -ignorepkg 'fmt,encoding/binary' path/to/package\n\nNote that this is equivalent to:\n\n    errcheck -ignore 'fmt:.*,encoding/binary:.*' path/to/package\n\nIf a regex is provided for a package `pkg` via `-ignore`, and `pkg` also appears\nin the list of packages passed to `-ignorepkg`, the latter takes precedence;\nthat is, all functions within `pkg` will be ignored.\n\nNote that by default the `fmt` package is ignored entirely, unless a regex is\nspecified for it. To disable this, specify a regex that matches nothing:\n\n    errcheck -ignore 'fmt:a^' path/to/package\n\nThe `-ignoretests` flag disables checking of `_test.go` files. It takes\nno arguments.\n\nThe `-ignoregenerated` flag disables checking of generated source code. It takes no arguments.\n\n## Exit Codes\n\nerrcheck returns 1 if any problems were found in the checked files.\nIt returns 2 if there were any other failures.\n\n# Editor Integration\n\n## Emacs\n\n[go-errcheck.el](https://github.com/dominikh/go-errcheck.el)\nintegrates errcheck with Emacs by providing a `go-errcheck` command\nand customizable variables to automatically pass flags to errcheck.\n\n## Vim\n\n[vim-go](https://github.com/fatih/vim-go) can run errcheck via both its `:GoErrCheck`\nand `:GoMetaLinter` commands.\n","funding_links":[],"categories":["Misc","开源类库","Go","Code Analysis","Code Checking","Open source library","Linters","代码分析","Programming Languages","相关工具`go相关工具和插件`","相关工具","[](https://github.com/golang/go/wiki/CodeTools#error-detection)Error Detection","代碼分析","Libraries for creating HTTP middlewares","Repositories"],"sub_categories":["代码分析","Routers","HTTP Load testing","Code Analysis","Bugs","Middlewares","路由器","[](https://github.com/golang/go/wiki/CodeTools#tools-2)Tools","Contents","路由"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkisielk%2Ferrcheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkisielk%2Ferrcheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkisielk%2Ferrcheck/lists"}