github.com/chenfeining/golangci-lint@v1.0.2-0.20230730162517-14c6c67868df/pkg/golinters/staticcheck.go (about)

     1  package golinters
     2  
     3  import (
     4  	"honnef.co/go/tools/staticcheck"
     5  
     6  	"github.com/chenfeining/golangci-lint/pkg/config"
     7  	"github.com/chenfeining/golangci-lint/pkg/golinters/goanalysis"
     8  )
     9  
    10  func NewStaticcheck(settings *config.StaticCheckSettings) *goanalysis.Linter {
    11  	cfg := staticCheckConfig(settings)
    12  	analyzers := setupStaticCheckAnalyzers(staticcheck.Analyzers, getGoVersion(settings), cfg.Checks)
    13  
    14  	return goanalysis.NewLinter(
    15  		"staticcheck",
    16  		"It's a set of rules from staticcheck. It's not the same thing as the staticcheck binary."+
    17  			" The author of staticcheck doesn't support or approve the use of staticcheck as a library inside golangci-lint.",
    18  		analyzers,
    19  		nil,
    20  	).WithLoadMode(goanalysis.LoadModeTypesInfo)
    21  }