82 lines
2.6 KiB
Go
82 lines
2.6 KiB
Go
// Copyright 2018 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.
|
|
|
|
// The analyze command is a static checker for Go programs, similar to
|
|
// vet, but with pluggable analyzers defined using the analysis
|
|
// interface, and using the go/packages API to load packages in any
|
|
// build system.
|
|
//
|
|
// Each analysis flag name is preceded by the analysis name: --analysis.flag.
|
|
// In addition, the --analysis.enabled flag controls whether the
|
|
// diagnostics of that analysis are displayed. (A disabled analysis may yet
|
|
// be run if it is required by some other analysis that is enabled.)
|
|
package main
|
|
|
|
import (
|
|
"golang.org/x/tools/go/analysis/multichecker"
|
|
|
|
// analysis plug-ins
|
|
"golang.org/x/tools/go/analysis/passes/asmdecl"
|
|
"golang.org/x/tools/go/analysis/passes/assign"
|
|
"golang.org/x/tools/go/analysis/passes/atomic"
|
|
"golang.org/x/tools/go/analysis/passes/bools"
|
|
"golang.org/x/tools/go/analysis/passes/buildtag"
|
|
"golang.org/x/tools/go/analysis/passes/cgocall"
|
|
"golang.org/x/tools/go/analysis/passes/composite"
|
|
"golang.org/x/tools/go/analysis/passes/copylock"
|
|
"golang.org/x/tools/go/analysis/passes/findcall"
|
|
"golang.org/x/tools/go/analysis/passes/httpresponse"
|
|
"golang.org/x/tools/go/analysis/passes/loopclosure"
|
|
"golang.org/x/tools/go/analysis/passes/lostcancel"
|
|
"golang.org/x/tools/go/analysis/passes/nilfunc"
|
|
"golang.org/x/tools/go/analysis/passes/nilness"
|
|
"golang.org/x/tools/go/analysis/passes/pkgfact"
|
|
"golang.org/x/tools/go/analysis/passes/printf"
|
|
"golang.org/x/tools/go/analysis/passes/shift"
|
|
"golang.org/x/tools/go/analysis/passes/stdmethods"
|
|
"golang.org/x/tools/go/analysis/passes/structtag"
|
|
"golang.org/x/tools/go/analysis/passes/tests"
|
|
"golang.org/x/tools/go/analysis/passes/unreachable"
|
|
"golang.org/x/tools/go/analysis/passes/unsafeptr"
|
|
"golang.org/x/tools/go/analysis/passes/unusedresult"
|
|
)
|
|
|
|
func main() {
|
|
multichecker.Main(
|
|
// the traditional vet suite:
|
|
asmdecl.Analyzer,
|
|
assign.Analyzer,
|
|
atomic.Analyzer,
|
|
bools.Analyzer,
|
|
buildtag.Analyzer,
|
|
cgocall.Analyzer,
|
|
composite.Analyzer,
|
|
copylock.Analyzer,
|
|
httpresponse.Analyzer,
|
|
loopclosure.Analyzer,
|
|
lostcancel.Analyzer,
|
|
nilfunc.Analyzer,
|
|
pkgfact.Analyzer,
|
|
printf.Analyzer,
|
|
// shadow.Analyzer, // experimental; not enabled by default
|
|
shift.Analyzer,
|
|
stdmethods.Analyzer,
|
|
structtag.Analyzer,
|
|
tests.Analyzer,
|
|
unreachable.Analyzer,
|
|
unsafeptr.Analyzer,
|
|
unusedresult.Analyzer,
|
|
|
|
// for debugging:
|
|
findcall.Analyzer,
|
|
|
|
// use SSA:
|
|
nilness.Analyzer,
|
|
|
|
// Work in progress:
|
|
// httpheader.Analyzer,
|
|
// deadcode.Analyzer,
|
|
)
|
|
}
|