{"id":37114152,"url":"https://github.com/losinggeneration/gometalinter","last_synced_at":"2026-01-14T13:26:34.064Z","repository":{"id":57586280,"uuid":"77182528","full_name":"losinggeneration/gometalinter","owner":"losinggeneration","description":"Concurrently run Go lint tools and normalise their output","archived":false,"fork":true,"pushed_at":"2016-12-22T23:37:34.000Z","size":4134,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T11:06:14.192Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"alecthomas/gometalinter","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/losinggeneration.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-22T23:19:51.000Z","updated_at":"2016-12-22T23:19:53.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/losinggeneration/gometalinter","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/losinggeneration/gometalinter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losinggeneration%2Fgometalinter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losinggeneration%2Fgometalinter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losinggeneration%2Fgometalinter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losinggeneration%2Fgometalinter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/losinggeneration","download_url":"https://codeload.github.com/losinggeneration/gometalinter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losinggeneration%2Fgometalinter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28421173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":[],"created_at":"2026-01-14T13:26:33.530Z","updated_at":"2026-01-14T13:26:34.053Z","avatar_url":"https://github.com/losinggeneration.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go Meta Linter [![Build Status](https://travis-ci.org/alecthomas/gometalinter.png)](https://travis-ci.org/alecthomas/gometalinter)\n\nThe number of tools for statically checking Go source for errors and warnings\nis impressive.\n\nThis is a tool that concurrently runs a whole bunch of those linters and\nnormalises their output to a standard format:\n\n    \u003cfile\u003e:\u003cline\u003e:[\u003ccolumn\u003e]: \u003cmessage\u003e (\u003clinter\u003e)\n\neg.\n\n    stutter.go:9::warning: unused global variable unusedGlobal (varcheck)\n    stutter.go:12:6:warning: exported type MyStruct should have comment or be unexported (golint)\n\nIt is intended for use with editor/IDE integration.\n\n## Editor integration\n\n- [SublimeLinter plugin](https://github.com/alecthomas/SublimeLinter-contrib-gometalinter).\n- [vim-go](https://github.com/fatih/vim-go) with the `:GoMetaLinter` command.\n- [syntastic (vim)](https://github.com/scrooloose/syntastic/wiki/Go:---gometalinter) `let g:syntastic_go_checkers = ['gometalinter']`\n- [Atom linter plugin](https://atom.io/packages/gometalinter-linter).\n- [Emacs Flycheck checker](https://github.com/favadi/flycheck-gometalinter).\n- [Go for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=lukehoban.Go).\n\n## Supported linters\n\n- [go vet](https://golang.org/cmd/vet/) - Reports potential errors that otherwise compile.\n- [go vet --shadow](https://golang.org/cmd/vet/#hdr-Shadowed_variables) - Reports variables that may have been unintentionally shadowed.\n- [gotype](https://golang.org/x/tools/cmd/gotype) - Syntactic and semantic analysis similar to the Go compiler.\n- [deadcode](https://github.com/tsenart/deadcode) - Finds unused code.\n- [gocyclo](https://github.com/alecthomas/gocyclo) - Computes the cyclomatic complexity of functions.\n- [golint](https://github.com/golang/lint) - Google's (mostly stylistic) linter.\n- [varcheck](https://github.com/opennota/check) - Find unused global variables and constants.\n- [structcheck](https://github.com/opennota/check) - Find unused struct fields.\n- [aligncheck](https://github.com/opennota/check) - Warn about un-optimally aligned structures.\n- [errcheck](https://github.com/kisielk/errcheck) - Check that error return values are used.\n- [dupl](https://github.com/mibk/dupl) - Reports potentially duplicated code.\n- [ineffassign](https://github.com/gordonklaus/ineffassign/blob/master/list) - Detect when assignments to *existing* variables are not used.\n- [interfacer](https://github.com/mvdan/interfacer) - Suggest narrower interfaces that can be used.\n- [unconvert](https://github.com/mdempsky/unconvert) - Detect redundant type conversions.\n- [goconst](https://github.com/jgautheron/goconst) - Finds repeated strings that could be replaced by a constant.\n- [gosimple](https://github.com/dominikh/go-simple) - Report simplifications in code.\n- [staticcheck](https://github.com/dominikh/go-staticcheck) - Statically detect bugs, both obvious and subtle ones.\n\nDisabled by default (enable with `--enable=\u003clinter\u003e`):\n\n- [testify](https://github.com/stretchr/testify) - Show location of failed testify assertions.\n- [test](http://golang.org/pkg/testing/) - Show location of test failures from the stdlib testing module.\n- [gofmt -s](https://golang.org/cmd/gofmt/) - Checks if the code is properly formatted and could not be further simplified.\n- [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports) - Checks missing or unreferenced package imports.\n- [lll](https://github.com/walle/lll) - Report long lines (see `--line-length=N`).\n- [misspell](https://github.com/client9/misspell) - Finds commonly misspelled English words.\n- [unused](https://github.com/dominikh/go-unused) - Find unused variables.\n\nAdditional linters can be added through the command line with `--linter=NAME:COMMAND:PATTERN` (see [below](#details)).\n\n### Configuration file\n\ngometalinter now supports a JSON configuration file which can be loaded via\n`--config=\u003cfile\u003e`. The format of this file is determined by the Config struct\nin `config.go`.\n\nThe configuration file mostly corresponds to command-line flags, with the following exceptions:\n\n- Linters defined in the configuration file will overlay existing definitions, not replace them.\n- \"Enable\" defines the exact set of linters that will be enabled.\n\nHere is an example configuration file:\n\n```json\n{\n  \"DisableAll\": true,\n  \"Enable\": [\"deadcode\", \"unconvert\"]\n}\n```\n\n## Installing\n\nThere are two options for installing gometalinter.\n\n1. Install a stable version, eg. `go get -u gopkg.in/alecthomas/gometalinter.v1`.\n   I will generally only tag a new stable version when it has passed the Travis\n  regression tests. The downside is that the binary will be called `gometalinter.v1`.\n2. Install from HEAD with: `go get -u github.com/alecthomas/gometalinter`.\n   This has the downside that changes to gometalinter may break.\n\n## Quickstart\n\nInstall gometalinter:\n\n```\n$ go get -u github.com/alecthomas/gometalinter\n```\n\nInstall all known linters:\n\n```\n$ gometalinter --install\nInstalling:\n  structcheck\n  aligncheck\n  deadcode\n  gocyclo\n  ineffassign\n  dupl\n  golint\n  gotype\n  goimports\n  errcheck\n  varcheck\n  interfacer\n  goconst\n  gosimple\n  staticcheck\n  unused\n  misspell\n  lll\n```\n\nRun it:\n\n```\n$ cd example\n$ gometalinter ./...\nstutter.go:13::warning: unused struct field MyStruct.Unused (structcheck)\nstutter.go:9::warning: unused global variable unusedGlobal (varcheck)\nstutter.go:12:6:warning: exported type MyStruct should have comment or be unexported (golint)\nstutter.go:16:6:warning: exported type PublicUndocumented should have comment or be unexported (golint)\nstutter.go:8:1:warning: unusedGlobal is unused (deadcode)\nstutter.go:12:1:warning: MyStruct is unused (deadcode)\nstutter.go:16:1:warning: PublicUndocumented is unused (deadcode)\nstutter.go:20:1:warning: duplicateDefer is unused (deadcode)\nstutter.go:21:15:warning: error return value not checked (defer a.Close()) (errcheck)\nstutter.go:22:15:warning: error return value not checked (defer a.Close()) (errcheck)\nstutter.go:27:6:warning: error return value not checked (doit()           // test for errcheck) (errcheck)\nstutter.go:29::error: unreachable code (vet)\nstutter.go:26::error: missing argument for Printf(\"%d\"): format reads arg 1, have only 0 args (vet)\n```\n\n\nGometalinter also supports the commonly seen `\u003cpath\u003e/...` recursive path\nformat. Note that this can be *very* slow, and you may need to increase the linter `--deadline` to allow linters to complete.\n\n## FAQ\n\n### Exit status\n\ngometalinter sets two bits of the exit status to indicate different issues:\n\n| Bit | Meaning\n|-----|----------\n| 0   | A linter generated an issue.\n| 1   | An underlying error occurred; eg. a linter failed to execute. In this situation a warning will also be displayed.\n\neg. linter only = 1, underlying only = 2, linter + underlying = 3\n\n### What's the best way to use `gometalinter` in CI?\n\nThere are two main problems running in a CI:\n\n1. \u003cs\u003eLinters break, causing `gometalinter --install --update` to error\u003c/s\u003e (this is no longer an issue as all linters are vendored).\n2. `gometalinter` adds a new linter.\n\nThere is no great solution to 1, but for 2, the best option is to disable all linters, then explicitly enable the ones you want:\n\n    gometalinter --disable-all --enable=errcheck --enable=vet --enable=vetshadow ...\n\n### How do I make `gometalinter` work with Go 1.5 vendoring?\n\n`gometalinter` has a `--vendor` flag that just sets `GO15VENDOREXPERIMENT=1`, however the\nunderlying tools must support it. Ensure that all of the linters are up to date and built with Go 1.5\n(`gometalinter --install --force`) then run `gometalinter --vendor .`. That should be it.\n\n### Why does `gometalinter --install` install a fork of gocyclo?\n\nI forked `gocyclo` because the upstream behaviour is to recursively check all\nsubdirectories even when just a single directory is specified. This made it\nunusably slow when vendoring. The recursive behaviour can be achieved with\ngometalinter by explicitly specifying `\u003cpath\u003e/...`. There is a\n[pull request](https://github.com/fzipp/gocyclo/pull/1) open.\n\n### Gometalinter is not working\n\nThat's more of a statement than a question, but okay.\n\nSometimes gometalinter will not report issues that you think it should. There\nare three things to try in that case:\n\n#### 1. Update to the latest build of gometalinter and all linters\n\n    go get -u github.com/alecthomas/gometalinter\n    gometalinter --install\n\nIf you're lucky, this will fix the problem.\n\n#### 2. Analyse the debug output\n\nIf that doesn't help, the problem may be elsewhere (in no particular order):\n\n1. Upstream linter has changed its output or semantics.\n2. gometalinter is not invoking the tool correctly.\n3. gometalinter regular expression matches are not correct for a linter.\n4. Linter is exceeding the deadline.\n\nTo find out what's going on run in debug mode:\n\n    gometalinter --debug\n\nThis will show all output from the linters and should indicate why it is\nfailing.\n\n#### 3. Report an issue.\n\nFailing all else, if the problem looks like a bug please file an issue and\ninclude the output of `gometalinter --debug`.\n\n## Details\n\nAdditional linters can be configured via the command line:\n\n```\n$ gometalinter --linter='vet:go tool vet -printfuncs=Infof,Debugf,Warningf,Errorf {path}:PATH:LINE:MESSAGE' .\nstutter.go:21:15:warning: error return value not checked (defer a.Close()) (errcheck)\nstutter.go:22:15:warning: error return value not checked (defer a.Close()) (errcheck)\nstutter.go:27:6:warning: error return value not checked (doit()           // test for errcheck) (errcheck)\nstutter.go:9::warning: unused global variable unusedGlobal (varcheck)\nstutter.go:13::warning: unused struct field MyStruct.Unused (structcheck)\nstutter.go:12:6:warning: exported type MyStruct should have comment or be unexported (golint)\nstutter.go:16:6:warning: exported type PublicUndocumented should have comment or be unexported (deadcode)\n```\n\n## Checkstyle XML format\n\n`gometalinter` supports [checkstyle](http://checkstyle.sourceforge.net/)\ncompatible XML output format. It is tiggered with `--checkstyle` flag:\n\n\tgometalinter --checkstyle\n\nCheckstyle format can be used to integrate gometalinter with Jenkins CI with the\nhelp of [Checkstyle Plugin](https://wiki.jenkins-ci.org/display/JENKINS/Checkstyle+Plugin).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flosinggeneration%2Fgometalinter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flosinggeneration%2Fgometalinter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flosinggeneration%2Fgometalinter/lists"}