Skip to content

rezakhademix/golangci-lint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 

Repository files navigation

A Golang Linter Configuration file for golangci-lint

This is an opinionated configuration file for golangci-lint. Before using this config file you need to do two steps:

1) install golangci-lint

# first way: binary will be $(go env GOPATH)/bin/golangci-lint

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


# alternative way: install it into user ./bin/

curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s latest


# docker:

docker run --rm -v $(pwd):/app -v ~/.cache/golangci-lint/v1.55.2:/root/.cache -w /app golangci/golangci-lint:latest golangci-lint run -v

2) put .golangci.yml in your project root directory

For more information and a well detailed story you can read What is A Golang Linter And How To Use It?.

For integrating golangci-lint with VSCode just put these line on user JSON settings file:

"go.lintTool": "golangci-lint-v2",
"go.lintFlags": [
  "--path-mode=abs",
  "--fast-only"
],
"go.formatTool": "gofmt",
"go.alternateTools": {
  "customFormatter": "golangci-lint-v2"
},
"go.formatFlags": [
  "fmt",
  "--stdin"
]

3) At last Run:

go install -v github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest

Used Linters

List of used linters inside config file:

About

An opinionated configuration file for golangci-lint.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published