Skip to content

snkrdunk/custom_linters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

custom_linters

custom_linters is a tool to run multiple linters at once using the multichecker package.

Installation

go install github.com/snkrdunk/custom_linters/cmd/custom_linters@latest

How to add analyzer

1. Add linter module to go.mod

go get github.com/path/to/module

If you want to add a private linter module, set GOPRIVATE to the repository or account path before executing go get command

export GOPRIVATE=github.com/snkrdunk

In this example, you can get private module from github.com/snkrdunk.

2. Add analyzer to cmd/custom_linters/custom_linters.go

 package main

 import (
+       "path/to/linter/linter_pkg"

        "github.com/snkrdunk/empty_err_checker"
        "golang.org/x/tools/go/analysis/multichecker"
 )
 
 func main() {
        multichecker.Main(
                empty_err_checker.Analyzer,
+               linter_pkg.Analyzer,
        )
 }

3. Add analyzer plugin/main.go

 package main

 import (
+       "path/to/linter/linter_pkg"

        "github.com/snkrdunk/empty_err_checker"
        "golang.org/x/tools/go/analysis"
 )

 func (analyzerPlugin) GetAnalyzers() []*analysis.Analyzer {
        return []*analysis.Analyzer{
                empty_err_checker.Analyzer,
+               linter_pkg.Analyzer,
        }
 }