.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools / gopls@v0.6.9 / internal / hooks / analysis.go
1 // Copyright 2019 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 //go:build go1.15
6 // +build go1.15
7
8 package hooks
9
10 import (
11         "golang.org/x/tools/go/analysis"
12         "golang.org/x/tools/internal/lsp/source"
13         "honnef.co/go/tools/simple"
14         "honnef.co/go/tools/staticcheck"
15         "honnef.co/go/tools/stylecheck"
16 )
17
18 func updateAnalyzers(options *source.Options) {
19         var analyzers []*analysis.Analyzer
20         for _, a := range simple.Analyzers {
21                 analyzers = append(analyzers, a)
22         }
23         for _, a := range staticcheck.Analyzers {
24                 switch a.Name {
25                 case "SA5009":
26                         // This check conflicts with the vet printf check (golang/go#34494).
27                 case "SA5011":
28                         // This check relies on facts from dependencies, which
29                         // we don't currently compute.
30                 default:
31                         analyzers = append(analyzers, a)
32                 }
33         }
34         for _, a := range stylecheck.Analyzers {
35                 analyzers = append(analyzers, a)
36         }
37         // Always add hooks for all available analyzers, but disable them if the
38         // user does not have staticcheck enabled (they may enable it later on).
39         for _, a := range analyzers {
40                 options.AddStaticcheckAnalyzer(a)
41         }
42 }