mirror of
https://github.com/golang/go
synced 2024-11-18 21:54:49 -07:00
3304cfb00f
If we release gopls/v0.4.0 soon, we should keep these new analyzers off by default. They were just merged, so they haven't been used enough to be enabled, I think. We'll turn them on by default for gopls/v0.5.0. Also, ended up creating a helper function to check if analysis has been abled (which fixed a small bug in FindAnalysisError), and another helper function to enable all analyses for testing purposes. Updates golang/go#38212 Change-Id: I5ee94b3582dfc0863978650fc6ce51bfa0606c13 Reviewed-on: https://go-review.googlesource.com/c/tools/+/226962 Run-TryBot: Rebecca Stambler <rstambler@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rohan Challa <rohan@golang.org>
31 lines
758 B
Go
31 lines
758 B
Go
// Copyright 2019 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package hooks
|
|
|
|
import (
|
|
"golang.org/x/tools/internal/lsp/source"
|
|
"honnef.co/go/tools/simple"
|
|
"honnef.co/go/tools/staticcheck"
|
|
"honnef.co/go/tools/stylecheck"
|
|
)
|
|
|
|
func updateAnalyzers(options *source.Options) {
|
|
if options.StaticCheck {
|
|
for _, a := range simple.Analyzers {
|
|
options.AddDefaultAnalyzer(a)
|
|
}
|
|
for _, a := range staticcheck.Analyzers {
|
|
// This check conflicts with the vet printf check (golang/go#34494).
|
|
if a.Name == "SA5009" {
|
|
continue
|
|
}
|
|
options.AddDefaultAnalyzer(a)
|
|
}
|
|
for _, a := range stylecheck.Analyzers {
|
|
options.AddDefaultAnalyzer(a)
|
|
}
|
|
}
|
|
}
|