Continuous Code Quality for Go

GolangCI detects and comments issues in GitHub pull requests: bugs, style violations, anti-pattern instances.

Automated Code Fixes

Linters

go vet

Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string.

errcheck

Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases.

golint

Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes.

staticcheck

Staticcheck is go vet on steroids, applying a ton of static analysis checks.

go-critic

The most opinionated Go source code linter.

unused

Checks Go code for unused constants, variables, functions and types.

gosimple

Linter for Go source code that specialises on simplifying code.

gas

Inspects source code for security problems.

structcheck

Finds unused struct fields.

varcheck

Finds unused global variables and constants.

interfacer

Linter that suggests narrower interface types.

unconvert

Remove unnecessary type conversions.

ineffassign

Detects when assignments to existing variables are not used.

goconst

Finds repeated strings that could be replaced by a constant.

deadcode

Finds unused code.

gofmt

Gofmt checks whether code was gofmt-ed. We run this tool with -s option to check for code simplification.

goimports

Goimports does everything that gofmt does. Additionally it checks unused imports.

bodyclose

Checks whether HTTP response body is closed successfully.

gochecknoglobals

Checks that no globals are present in Go code.

gochecknoinits

Checks that no init functions are present in Go code.

misspell

Finds commonly misspelled English words in comments.

nakedret

Finds naked returns in functions greater than a specified function length.

prealloc

Finds slice declarations that could potentially be preallocated.

scopelint

Scopelint checks for unpinned variables in go programs.

lll

Reports long lines.

maligned

Tool to detect Go structs that would take less memory if their fields were sorted.

dupl

Tool for code clone detection.

gocyclo

Computes and checks the cyclomatic complexity of functions.

typecheck

Like the front-end of a Go compiler, parses and type-checks Go code.

unparam

Reports unused function parameters.

depguard

Go linter that checks if package imports are in a list of acceptable packages.