Convert Figma logo to code with AI

golangci logogolangci-lint

Fast linters runner for Go

15,526
1,382
15,526
150

Top Related Projects

4,735

🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint

Staticcheck - The advanced Go linter

7,791

Go security checker

errcheck checks that you checked errors.

Correct commonly misspelled English words in source files

Quick Overview

GolangCI-Lint is a fast, parallel, and highly customizable linter for Go programming language. It integrates multiple linters and static analysis tools into a single command-line interface, providing developers with a comprehensive code quality check for their Go projects.

Pros

  • Fast execution due to parallel processing and caching mechanisms
  • Extensive set of linters (over 50) included out of the box
  • Highly configurable with the ability to enable/disable specific linters and customize their settings
  • Integrates well with various CI/CD pipelines and IDEs

Cons

  • Can be overwhelming for beginners due to the large number of linters and configuration options
  • Some linters may produce false positives or conflicting suggestions
  • Requires regular updates to keep up with the latest Go language features and best practices
  • May have a learning curve for teams transitioning from simpler linting tools

Getting Started

To install GolangCI-Lint, run:

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.3

Create a configuration file named .golangci.yml in your project root:

linters:
  enable:
    - gofmt
    - golint
    - govet
    - errcheck

issues:
  exclude-rules:
    - path: _test\.go
      linters:
        - errcheck

Run GolangCI-Lint in your project directory:

golangci-lint run

This will analyze your Go code using the enabled linters and display any issues found. Adjust the configuration file to customize the linting process according to your project's needs.

Competitor Comparisons

4,735

🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint

Pros of Revive

  • Faster execution time, especially for large codebases
  • More customizable and configurable, allowing fine-tuned rule sets
  • Easier to extend with custom rules

Cons of Revive

  • Fewer built-in linters compared to golangci-lint
  • Less comprehensive documentation and community support
  • May require more initial setup and configuration

Code Comparison

Revive configuration example:

ignoreGeneratedHeader = false
severity = "warning"
confidence = 0.8
errorCode = 1
warningCode = 0

[rule.blank-imports]
[rule.context-as-argument]
[rule.context-keys-type]
[rule.dot-imports]
[rule.error-return]

golangci-lint configuration example:

linters:
  enable:
    - deadcode
    - errcheck
    - gosimple
    - govet
    - ineffassign
    - staticcheck
    - structcheck
    - typecheck
    - unused
    - varcheck

Both tools offer powerful linting capabilities for Go projects, with golangci-lint providing a more comprehensive out-of-the-box experience and Revive offering greater flexibility and performance. The choice between them depends on project requirements and team preferences.

Staticcheck - The advanced Go linter

Pros of go-tools

  • Focuses on in-depth static analysis tools for Go
  • Provides specialized analyzers for specific issues (e.g., nilness, printf)
  • Offers more granular control over individual analysis tools

Cons of go-tools

  • Less user-friendly for beginners compared to golangci-lint
  • Requires more setup and configuration to use multiple tools together
  • Lacks a unified command-line interface for running all tools at once

Code Comparison

go-tools (using staticcheck):

package main

func main() {
    var x *int
    _ = *x // staticcheck will detect potential nil pointer dereference
}

golangci-lint:

package main

func main() {
    var x *int
    _ = *x // golangci-lint will also detect this issue with default configuration
}

Both tools can detect similar issues, but go-tools provides more specialized analyzers for deeper analysis in specific areas. golangci-lint offers a more integrated approach, combining multiple linters and providing an easier setup for developers.

7,791

Go security checker

Pros of gosec

  • Specialized focus on security-related issues in Go code
  • Integrates well with CI/CD pipelines for automated security checks
  • Provides detailed explanations and remediation advice for identified vulnerabilities

Cons of gosec

  • Limited scope compared to golangci-lint, focusing only on security issues
  • May produce more false positives due to its security-centric approach
  • Requires separate installation and configuration from other linting tools

Code Comparison

gosec example:

// gosec G104
_, err := os.Open(filename)
if err != nil {
    log.Print(err)
}

golangci-lint example:

// golangci-lint
var x int
x = 5 // ineffectual assignment
fmt.Println(x)

gosec focuses on security issues like unchecked errors, while golangci-lint covers a broader range of code quality checks. golangci-lint is a more comprehensive tool that includes multiple linters, including security checks, making it suitable for general code quality improvement. gosec, on the other hand, is specifically tailored for identifying security vulnerabilities in Go code, making it an excellent choice for projects with high security requirements or as an additional layer of security checking alongside other linting tools.

errcheck checks that you checked errors.

Pros of errcheck

  • Focused specifically on error checking, providing in-depth analysis
  • Lightweight and fast, with minimal setup required
  • Can be easily integrated into existing workflows or CI/CD pipelines

Cons of errcheck

  • Limited scope compared to golangci-lint's comprehensive set of linters
  • Fewer configuration options and customization possibilities
  • May require additional tools for a complete code quality analysis

Code Comparison

errcheck usage:

errcheck ./...

golangci-lint usage:

golangci-lint run

Both tools can be used to detect unchecked errors, but golangci-lint offers a broader range of linters and more extensive configuration options. errcheck is more focused and lightweight, making it a good choice for projects that primarily need error checking.

golangci-lint provides a unified interface for multiple linters, including errcheck functionality, while errcheck concentrates solely on identifying unchecked errors. The choice between the two depends on the specific needs of the project and the desired level of code analysis.

For comprehensive code quality checks, golangci-lint is generally preferred due to its extensive feature set. However, for projects that require a quick and focused error checking tool, errcheck remains a viable option.

Correct commonly misspelled English words in source files

Pros of misspell

  • Focused solely on spelling errors, making it lightweight and fast
  • Can be used across multiple file types, not just Go code
  • Offers automatic correction of misspellings

Cons of misspell

  • Limited in scope compared to golangci-lint's comprehensive linting capabilities
  • Doesn't provide static analysis or code quality checks beyond spelling
  • Less actively maintained, with fewer recent updates

Code Comparison

misspell:

func (s *Speller) ReplaceGo(src []byte) ([]byte, bool) {
    fset := token.NewFileSet()
    f, err := parser.ParseFile(fset, "", src, parser.ParseComments)
    if err != nil {
        return src, false
    }

golangci-lint:

func (r *Runner) runAnalysis(ctx context.Context, args []string) ([]result.Issue, error) {
    enabledLinters, err := r.EnabledLinters(ctx)
    if err != nil {
        return nil, errors.Wrap(err, "failed to get enabled linters")
    }

While misspell focuses on identifying and correcting spelling errors, golangci-lint provides a more comprehensive suite of linting tools for Go projects. misspell is simpler and more specialized, while golangci-lint offers broader code analysis capabilities.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

golangci-lint logo

golangci-lint

Fast linters runner for Go


golangci-lint is a fast Go linters runner.

It runs linters in parallel, uses caching, supports YAML configuration, integrates with all major IDEs, and includes over a hundred linters.

Install golangci-lint

Documentation

Documentation is hosted at https://golangci-lint.run.

Social Networks

Join Slack Follow on Mastodon Follow on Twitter

Supporting Us

Open Collective backers and sponsors GitHub Sponsors Linter Authors

golangci-lint is a free and open-source project built by volunteers.

If you value it, consider supporting us, we appreciate it! :heart:

Badges

Build Status License Release Docker GitHub Releases Stats of golangci-lint

Contributors

This project exists thanks to all the people who contribute. How to contribute.

Core Team

About core team

The GolangCI Core Team is a group of contributors who have demonstrated a lasting enthusiasm for the project and community. The GolangCI Core Team has GitHub admin privileges on the repo.

Responsibilities

The Core Team has the following responsibilities:

  1. Being available to answer high-level questions about vision and future.
  2. Being available to review longstanding/forgotten pull requests.
  3. Occasionally check issues, offer input, and categorize with GitHub issue labels.
  4. Looking out for up-and-coming members of the GolangCI community who might want to serve as Core Team members.
  5. Note that the Core Team – and all GolangCI contributors – are open-source volunteers; membership on the Core Team is expressly not an obligation. The Core Team is distinguished as leaders in the community and while they are a good group to turn to when someone needs an answer to a question, they are still volunteering their time, and may not be available to help immediately.

Ludovic Fernandez

Denis Isaev

Aleksandr Razumov

Team


Simon Sawert

Sergey Vilgelm

Oleksandr Redko

Tam Mach

Trevor Pounds

Anton Telyshev

Loong Dai

Oleg Butuzov

Kamil Samigullin

Sascha Grunert

@iwankgb

Andrew Shannon Brown

Marat Reymers

sivchari

@leonklingele

Ryan Currah

Pierre Durand

Sebastien Rosset

Sasha Melentyev

Denis Tingaikin

Patrick Ohly

Alexey Palazhchenko

David Lobe

Ville Skyttä

Duco van Amstel

Nishanth Shanmugham

Kensei Nakada

ccoVeille

Melvin

quasilyte

Denis Krivak

Alec Thomas

Mitsuo HEIJO

Steve Coffman

Maik Schreiber
And 509 more our team members

Nahshon Unna Tsameret

Tom

Matouš Dzivjak

Nuruddin Ashr

Will Dixon

Mateusz Gozdek

Mateus Oliveira

Peter Mescalchin

Michael Mulligan

Joe Wilner

Soichiro Kashima

Lucas Bremgartner

@alingse

Steven Hartland

Oleg Kovalov

@silverwind

Florian Bosdorff

Kir Kolyshkin

Tim Heckman

James

Colin Arnott

Ethan Reesor

Anton Zinovyev

@Zxilly

Luke T. Shumaker

Aleksey Bakin

Márk Sági-Kazár

Rski

Ryan Boehning

Gustavo Bazan

Eugene Simonov

Timon Wong

ferhat elmas

Nate Finch

Aliaksandr Mianzhynski

Aneesh Agrawal

sonatard

Leigh McCulloch

Denis Limarev

ZhangYunHao

Vladimir Evgrafov

Ryosei Karaki

gaojingyu

@odidev

Fabian Holler

NiseVoid

Christian Mehlmauer

Sean DuBois

Viktoras Makauskas

SystemGlitch

Yifei Liu

Agniva De Sarker

Adam Shannon

Ilia Sergunin

Henrik Johansson

Florent Viel

Tom Arrell

Choko

John Starich

Koichi Shiraishi

Bart

Neha Viswanathan

David Braley

Sam Zaydel

Lukas Malkmus

Vladislav Fursov

Olivier Mengué

Shulhan

Chris Bandy

Patrick Kuca

Viacheslav Poturaev

Catena cyber

@Abirdcfly

Hendry Wiranto

Robert Liebowitz

Gabriel Augendre

Mitar

Paweł Żak

Zik Aeroh

sylvia

Roman Chaliy

Zeal Wierslee

Kyoh

Tim Kral

Hiroyuki Yagihashi

Denis Voytyuk

Jiangnan Jia

Adam Jones

Kunwardeep

Pierre R

Stephan Renatus

Martin Desrumaux

tdakkota

Ivan

Carlos Henrique Guardão Gandarez

Diego Pontoriero

Daniel Helfand

Benjamin Wang

Craig Silverstein

Faisal Alam

Alex Collins

Ryo Nakao

Ryan Olds

Matthew Hughes

Matheus Macabu

Tommy Mühle

Sebastiaan van Stijn

Hans Wernetti

Carlos Alexandro Becker

Dominik K.

Joshua Timmons

Sindre Røkenes Myren

Bartłomiej Klimczak

Fata Nugraha

M. Ángel Jimeno

Jan Oopkaup

Chris Drew

Teiva Harsanyi

Brian Flad

Chris Suszynski

Sean McGinnis

@chenfeining

Kailun Qin

Misha Gusarov

Ariel Mashraki

Oscar

Denis Isaev

Dreamacro

Tom Payne

@fsouza

jessetang

Siarhei Navatski

Chris Halbert

Koya IWAMURA

Hiroki Suezawa

Lauris BH

Fabrice

Christoph Blecker

Mateusz Bilski

Jakub Chábek

Ben Ye

Stephen Brown II

lufe

@sg0hsmt

Stephanie Wilde-Hobbs

Cory LaNou

Vitaly Isaev

Derek Perkins

Adam Bouqdib

Pete Wagner

Renato Suero

Clifton Kaznocha

Buyanov Vladimir

Sven Anderson

Ben Wells

Jonathan Chappelow

Yuki Okushi

hbc

WÁNG Xuěruì

@796RCP92VZ

Kévin Dunglas

Eric Wohltman

Borja Clemente

Mattias de Zalenski

@AlduLonghi

Justin Fuller

masibw

Navneeth Jayendran

Eduard Castany

Sonia Hamilton

@black-06

Gianguido Sorà

Oksana Grishchenko

Gareth Jones

Berezhnoy Pavel

proton

Son Luong Ngoc

Henry

Aofei Sheng

rnben

Maksym Pavlenko

Ivan Prisyazhnyy

@ngehrsitz

John Reese

Matthew Gabeler-Lee

Matthew Dowdell

James Lucktaylor

Masahiro Furudate

Dale Hui

Ondrej Fabry

Aris Tzoumas

Gabor Javorszky

hori-ryota

Kishan B

Eugene R.

Eric Jain

Ghvst Code

Markus

Sebastian Spaink

Andrew Lavery

Mark Fine

Rory Prendergast

Olli Raula

Tariq

Peter Štibraný

kaixiang zhong

@ced42

David Bariod

Stephen Benjamin

@kkHAIKE

Hsing-Yu (David) Chen

Batuhan Apaydın

Roman Gerasimov

Mostafa Moradian

@jkeys089

过客龙门

Eldar Rakhimberdin

Toon Schoenmakers

Cezar Sá Espinola

Ben Paxton

Connor Adams

Draven

David Cuadrado

Max Riveiro

Jeroen Demeyer

Mārtiņš Irbe

Yilong Li

Rodrigo Brito

@techknowlogick

takaya

Craig Furman

@ttys3

Michael Freeman

Mark Sart

Joshua Rubin

Danil Ovchinnikov

Rafael Franco

Ksenia Rogova

Paul Vaughan

Jared Allard

Glen Mailer

Ian Howell

Chris K

Grigory Zubankov

@xxpxxxxp

subham sarkar

Ryan Leung

Donal Byrne

@trajan0x

Yusuke Kadowaki

@CfirTsabari

Navneeth Jayendran

Marko

Chris Lewis

Muhammad Ikhsan

Anton Braer

Jaegoo Kim

David Gleich

@connorszczepaniak-wk

yuqengo

Dejan Benedik

Craig Rodrigues

Askari

Amir Hosseini

David Beitey

Brandur Leach

Dan Richelson

Denis Titusov

Daniil Pershin

Terdunov Vyacheslav

Sean Chittenden

Hui Zhu

@Harsimran1

rinsuki

Anton Antonov

@hn8

Kevin Gillette

Milas Bowman

@credativ-dar

Sean Lewis

☃ Elliot Shepherd

Nicolae Vartolomei

Martin Etmajer

Fisher Xu

Matthew Poer

Cody Ley-Han

@darklore

@to6ka

Wilkins

Collin Kreklow

Marcin Owsiany

C.J. Jameson

Jacek

paul fisher

@ofw

Rafik Draoui

Miles Delahunty

Anton Kachurin

Nico Ismaili

Benjamin Kane

Philip Linell

Herman van Zyl

Jongwoo Han

Yury Gargay

Jan Carreras

aimuz

Ryo Sato

Eric Zimanyi

Ben Bernays

Boban Acimovic

Tiago Peczenyj

Sean Trantalis

Viktor Alenkov

Eduardo Alves

Alex Bagnolini

Dima

David Hill

Troy Ronda

Andrey Grazhdankov

Ash McKenzie

K4YT3X

Florian Gessner

Osamu TONOMORI

Bo Liu

Steven Allen

Colin Arnott

Eran Levy

Roman Leventov

Hugo

Mathias Weber

Naveen

@maxsond

Maksim Meshkov

@raffepaffe

Abhinav Gupta

Michael

Evgeniy Kulikov

Chris Nesbitt-Smith

Daniel Caballero

Igor Zibarev

Carl Henderson

Shintaro Anazawa

Matt Braymer-Hayes

Arjen van der Ende

Pete Davison

Nanguan Lin

Devon Stewart

Silas Sewell

Tomas Dabašinskas

@xuri

Charl Matthee

Sriram Venkatesh

Peter Schuller

David Golub

Alexander Morozov

Pastoh

Liam White

Alex Dupre

Juanito

Jinming Yue

@wxdao

Sijie Yang

Stephen

Thang Minh Vu

Julia Ogris

Greg Curtis

@ac-rappi

Dudás Ádám

Abhishek | अभिषेक

Daniele

Takumasa Sakao

Ben Drucker

Matthew Cobbing

@Darlez

Kirill Danshin

mook

Kyungmin Bae

Dylan Arbour

Cory Miller

Ben Brown

Dor

sink

João Freitas

nick

David Bendory

@znley

Jonathan Colby

Justin Robertson

Caleb Xu

Tobias

Namco

Vasyl Haievyi

@andreykuchin

Irina

Petr Pučil

Aaron Bennett

zaunist

Egor Kovetskiy

Daniil Suvorov

Yuki Watanabe

Aisuko

Tung Leo

Kunal Singh

Rui Chen

Rez

Alexandre Vilain

Federico Guerinoni

Matias Lahti

Thirukumaran Vaseeharan

Alessio Treglia

Alay Patel

Linus Arver

Martin Hutchinson

Emanuel Bennici

Mayo

smantic

Sebastian Crane

Alexander Else

@vladopajic

@oxr463

Trim21

@eiffel-fl

@oliverpool

@Ak-Army

@humancalico

Christian Clauss

Johanan Liebermann

Korjavin Ivan

Eng Zer Jun

Mateus Esdras

Devin Gunay

Hilário Coelho

Thomas Cave

Selim Can CABA

Tibo Delor

@chainchad

Francois Parquet

Robert Kopaczewski

Marc Tudurí

@pohang

Cyrille Meichel

neglect-yp

Felix

Adrien

Joe Bergevin

Axetroy

Guillaume JG

Evan Cordell

靳灿奇

Nassos Kat

hitzhangjie

Jesse Donat

Oleg Shparber

Tomi Juntunen

Miel Donkers

Marccio Silva

Bastian

Tiago Silva

KADOTA, Kyohei

Conor Evans

Anirudh Sylendranath

@jumpeiMano

Alex Rodin

Oliver Gugger

Bryan Andrews

@TomerJLevy

Dmitry Titov

Thomas Gorham

Wei Jian Gan

Tamás Gulácsi

Jack Wilsdon

Michał Suchwałko

Alexander Apalikov

Domas Tamašauskas

Stéphane Chausson

neo_sli

@srdhoni

@derekhuizhang

takaokanbe

Sean Schneeweiss

pprzekwas

madflow

Arman Tarkhanian

John Adler

@licraft2019

@mlueckest

Malte Ehrlen

@golangaccount

Tyler Dorn

Enmanuel Moreira

Sylvain Rabot

Piotr Persona

Han Gyoung-Su

Harry Tennent

Kamyar Mirzavaziri

@w1ck3dg0ph3r

Richard Yuh

caption

Yi Song

guoguangwu

Artem K

R. Aidan Campbell

Mikhail Podtserkovskiy

oz

Erik Westra

Thomas Bonfort

Matthieu MOREL

Jared Szechy

Wilhelm Ågren

Stargazers over time

Stargazers over time