Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools / gopls@v0.5.2 / 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 package hooks
6
7 import (
8         "golang.org/x/tools/go/analysis"
9         "golang.org/x/tools/internal/lsp/source"
10         "honnef.co/go/tools/simple"
11         "honnef.co/go/tools/staticcheck"
12         "honnef.co/go/tools/stylecheck"
13 )
14
15 func updateAnalyzers(options *source.Options) {
16         var analyzers []*analysis.Analyzer
17         for _, a := range simple.Analyzers {
18                 analyzers = append(analyzers, a)
19         }
20         for _, a := range staticcheck.Analyzers {
21                 switch a.Name {
22                 case "SA5009":
23                         // This check conflicts with the vet printf check (golang/go#34494).
24                 case "SA5011":
25                         // This check relies on facts from dependencies, which
26                         // we don't currently compute.
27                 default:
28                         analyzers = append(analyzers, a)
29                 }
30         }
31         for _, a := range stylecheck.Analyzers {
32                 analyzers = append(analyzers, a)
33         }
34         // Always add hooks for all available analyzers, but disable them if the
35         // user does not have staticcheck enabled (they may enable it later on).
36         for _, a := range analyzers {
37                 options.AddStaticcheckAnalyzer(a)
38         }
39 }