| 1 | // Copyright 2018 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 ignore |
| 6 | // +build ignore |
| 7 | |
| 8 | // This file provides an example command for static checkers |
| 9 | // conforming to the golang.org/x/tools/go/analysis API. |
| 10 | // It serves as a model for the behavior of the cmd/vet tool in $GOROOT. |
| 11 | // Being based on the unitchecker driver, it must be run by go vet: |
| 12 | // |
| 13 | // $ go build -o unitchecker main.go |
| 14 | // $ go vet -vettool=unitchecker my/project/... |
| 15 | // |
| 16 | // For a checker also capable of running standalone, use multichecker. |
| 17 | package main |
| 18 | |
| 19 | import ( |
| 20 | "golang.org/x/tools/go/analysis/unitchecker" |
| 21 | |
| 22 | "golang.org/x/tools/go/analysis/passes/asmdecl" |
| 23 | "golang.org/x/tools/go/analysis/passes/assign" |
| 24 | "golang.org/x/tools/go/analysis/passes/atomic" |
| 25 | "golang.org/x/tools/go/analysis/passes/bools" |
| 26 | "golang.org/x/tools/go/analysis/passes/buildtag" |
| 27 | "golang.org/x/tools/go/analysis/passes/cgocall" |
| 28 | "golang.org/x/tools/go/analysis/passes/composite" |
| 29 | "golang.org/x/tools/go/analysis/passes/copylock" |
| 30 | "golang.org/x/tools/go/analysis/passes/errorsas" |
| 31 | "golang.org/x/tools/go/analysis/passes/httpresponse" |
| 32 | "golang.org/x/tools/go/analysis/passes/loopclosure" |
| 33 | "golang.org/x/tools/go/analysis/passes/lostcancel" |
| 34 | "golang.org/x/tools/go/analysis/passes/nilfunc" |
| 35 | "golang.org/x/tools/go/analysis/passes/printf" |
| 36 | "golang.org/x/tools/go/analysis/passes/shift" |
| 37 | "golang.org/x/tools/go/analysis/passes/stdmethods" |
| 38 | "golang.org/x/tools/go/analysis/passes/structtag" |
| 39 | "golang.org/x/tools/go/analysis/passes/tests" |
| 40 | "golang.org/x/tools/go/analysis/passes/unmarshal" |
| 41 | "golang.org/x/tools/go/analysis/passes/unreachable" |
| 42 | "golang.org/x/tools/go/analysis/passes/unsafeptr" |
| 43 | "golang.org/x/tools/go/analysis/passes/unusedresult" |
| 44 | ) |
| 45 | |
| 46 | func main() { |
| 47 | unitchecker.Main( |
| 48 | asmdecl.Analyzer, |
| 49 | assign.Analyzer, |
| 50 | atomic.Analyzer, |
| 51 | bools.Analyzer, |
| 52 | buildtag.Analyzer, |
| 53 | cgocall.Analyzer, |
| 54 | composite.Analyzer, |
| 55 | copylock.Analyzer, |
| 56 | errorsas.Analyzer, |
| 57 | httpresponse.Analyzer, |
| 58 | loopclosure.Analyzer, |
| 59 | lostcancel.Analyzer, |
| 60 | nilfunc.Analyzer, |
| 61 | printf.Analyzer, |
| 62 | shift.Analyzer, |
| 63 | stdmethods.Analyzer, |
| 64 | structtag.Analyzer, |
| 65 | tests.Analyzer, |
| 66 | unmarshal.Analyzer, |
| 67 | unreachable.Analyzer, |
| 68 | unsafeptr.Analyzer, |
| 69 | unusedresult.Analyzer, |
| 70 | ) |
| 71 | } |
| 72 |
Members