github.com/elek/golangci-lint@v1.42.2-0.20211208090441-c05b7fcb3a9a/pkg/golinters/typecheck.go (about)

     1  package golinters
     2  
     3  import (
     4  	"golang.org/x/tools/go/analysis"
     5  
     6  	"github.com/elek/golangci-lint/pkg/golinters/goanalysis"
     7  )
     8  
     9  func NewTypecheck() *goanalysis.Linter {
    10  	const linterName = "typecheck"
    11  
    12  	analyzer := &analysis.Analyzer{
    13  		Name: linterName,
    14  		Doc:  goanalysis.TheOnlyanalyzerDoc,
    15  		Run: func(pass *analysis.Pass) (interface{}, error) {
    16  			return nil, nil
    17  		},
    18  	}
    19  
    20  	linter := goanalysis.NewLinter(
    21  		linterName,
    22  		"Like the front-end of a Go compiler, parses and type-checks Go code",
    23  		[]*analysis.Analyzer{analyzer},
    24  		nil,
    25  	).WithLoadMode(goanalysis.LoadModeTypesInfo)
    26  
    27  	return linter
    28  }