Source file src/cmd/vet/main.go

     1  // Copyright 2012 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 main
     6  
     7  import (
     8  	"cmd/internal/objabi"
     9  	"cmd/internal/telemetry/counter"
    10  	"flag"
    11  
    12  	"golang.org/x/tools/go/analysis/unitchecker"
    13  
    14  	"golang.org/x/tools/go/analysis/passes/appends"
    15  	"golang.org/x/tools/go/analysis/passes/asmdecl"
    16  	"golang.org/x/tools/go/analysis/passes/assign"
    17  	"golang.org/x/tools/go/analysis/passes/atomic"
    18  	"golang.org/x/tools/go/analysis/passes/bools"
    19  	"golang.org/x/tools/go/analysis/passes/buildtag"
    20  	"golang.org/x/tools/go/analysis/passes/cgocall"
    21  	"golang.org/x/tools/go/analysis/passes/composite"
    22  	"golang.org/x/tools/go/analysis/passes/copylock"
    23  	"golang.org/x/tools/go/analysis/passes/defers"
    24  	"golang.org/x/tools/go/analysis/passes/directive"
    25  	"golang.org/x/tools/go/analysis/passes/errorsas"
    26  	"golang.org/x/tools/go/analysis/passes/framepointer"
    27  	"golang.org/x/tools/go/analysis/passes/httpresponse"
    28  	"golang.org/x/tools/go/analysis/passes/ifaceassert"
    29  	"golang.org/x/tools/go/analysis/passes/loopclosure"
    30  	"golang.org/x/tools/go/analysis/passes/lostcancel"
    31  	"golang.org/x/tools/go/analysis/passes/nilfunc"
    32  	"golang.org/x/tools/go/analysis/passes/printf"
    33  	"golang.org/x/tools/go/analysis/passes/shift"
    34  	"golang.org/x/tools/go/analysis/passes/sigchanyzer"
    35  	"golang.org/x/tools/go/analysis/passes/slog"
    36  	"golang.org/x/tools/go/analysis/passes/stdmethods"
    37  	"golang.org/x/tools/go/analysis/passes/stdversion"
    38  	"golang.org/x/tools/go/analysis/passes/stringintconv"
    39  	"golang.org/x/tools/go/analysis/passes/structtag"
    40  	"golang.org/x/tools/go/analysis/passes/testinggoroutine"
    41  	"golang.org/x/tools/go/analysis/passes/tests"
    42  	"golang.org/x/tools/go/analysis/passes/timeformat"
    43  	"golang.org/x/tools/go/analysis/passes/unmarshal"
    44  	"golang.org/x/tools/go/analysis/passes/unreachable"
    45  	"golang.org/x/tools/go/analysis/passes/unsafeptr"
    46  	"golang.org/x/tools/go/analysis/passes/unusedresult"
    47  )
    48  
    49  func main() {
    50  	counter.Open()
    51  	objabi.AddVersionFlag()
    52  
    53  	counter.Inc("vet/invocations")
    54  	unitchecker.Main(
    55  		appends.Analyzer,
    56  		asmdecl.Analyzer,
    57  		assign.Analyzer,
    58  		atomic.Analyzer,
    59  		bools.Analyzer,
    60  		buildtag.Analyzer,
    61  		cgocall.Analyzer,
    62  		composite.Analyzer,
    63  		copylock.Analyzer,
    64  		defers.Analyzer,
    65  		directive.Analyzer,
    66  		errorsas.Analyzer,
    67  		framepointer.Analyzer,
    68  		httpresponse.Analyzer,
    69  		ifaceassert.Analyzer,
    70  		loopclosure.Analyzer,
    71  		lostcancel.Analyzer,
    72  		nilfunc.Analyzer,
    73  		printf.Analyzer,
    74  		shift.Analyzer,
    75  		sigchanyzer.Analyzer,
    76  		slog.Analyzer,
    77  		stdmethods.Analyzer,
    78  		stdversion.Analyzer,
    79  		stringintconv.Analyzer,
    80  		structtag.Analyzer,
    81  		tests.Analyzer,
    82  		testinggoroutine.Analyzer,
    83  		timeformat.Analyzer,
    84  		unmarshal.Analyzer,
    85  		unreachable.Analyzer,
    86  		unsafeptr.Analyzer,
    87  		unusedresult.Analyzer,
    88  	)
    89  
    90  	// It's possible that unitchecker will exit early. In
    91  	// those cases the flags won't be counted.
    92  	counter.CountFlags("vet/flag:", *flag.CommandLine)
    93  }
    94  

View as plain text