From aed303cbaa74a4d974e6e79dae05b2901ff009e8 Mon Sep 17 00:00:00 2001 From: Michael Matloob Date: Wed, 28 Aug 2019 17:19:44 -0400 Subject: [PATCH] go/analysis/cmd/vet: remove The existence of two versions of vet, namely this one and the one in the Go distribution, creates confusion. Remove this one. Fixes golang/go#31886 Change-Id: I351ad95329088f91f6a88452ee8e3654849f6ef2 Reviewed-on: https://go-review.googlesource.com/c/tools/+/192177 Run-TryBot: Michael Matloob TryBot-Result: Gobot Gobot Reviewed-by: Ian Cottrell --- go/analysis/cmd/vet/README | 33 --------------- go/analysis/cmd/vet/vet.go | 83 -------------------------------------- 2 files changed, 116 deletions(-) delete mode 100644 go/analysis/cmd/vet/README delete mode 100644 go/analysis/cmd/vet/vet.go diff --git a/go/analysis/cmd/vet/README b/go/analysis/cmd/vet/README deleted file mode 100644 index 5ab75494d3..0000000000 --- a/go/analysis/cmd/vet/README +++ /dev/null @@ -1,33 +0,0 @@ -Vet is a tool that checks correctness of Go programs. It runs a suite of tests, -each tailored to check for a particular class of errors. Examples include incorrect -Printf format verbs and malformed build tags. - -Over time many checks have been added to vet's suite, but many more have been -rejected as not appropriate for the tool. The criteria applied when selecting which -checks to add are: - -Correctness: - -Vet's checks are about correctness, not style. A vet check must identify real or -potential bugs that could cause incorrect compilation or execution. A check that -only identifies stylistic points or alternative correct approaches to a situation -is not acceptable. - -Frequency: - -Vet is run every day by many programmers, often as part of every compilation or -submission. The cost in execution time is considerable, especially in aggregate, -so checks must be likely enough to find real problems that they are worth the -overhead of the added check. A new check that finds only a handful of problems -across all existing programs, even if the problem is significant, is not worth -adding to the suite everyone runs daily. - -Precision: - -Most of vet's checks are heuristic and can generate both false positives (flagging -correct programs) and false negatives (not flagging incorrect ones). The rate of -both these failures must be very small. A check that is too noisy will be ignored -by the programmer overwhelmed by the output; a check that misses too many of the -cases it's looking for will give a false sense of security. Neither is acceptable. -A vet check must be accurate enough that everything it reports is worth examining, -and complete enough to encourage real confidence. diff --git a/go/analysis/cmd/vet/vet.go b/go/analysis/cmd/vet/vet.go deleted file mode 100644 index ec6dcb92ca..0000000000 --- a/go/analysis/cmd/vet/vet.go +++ /dev/null @@ -1,83 +0,0 @@ -// 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 vet command is a static checker for Go programs. It has pluggable -// analyzers defined using the golang.org/x/tools/go/analysis API, and -// using the golang.org/x/tools/go/packages API to load packages in any -// build system. -// -// Each analyzer flag name is preceded by the analyzer name: -NAME.flag. -// In addition, the -NAME flag itself controls whether the -// diagnostics of that analyzer are displayed. (A disabled analyzer may yet -// be run if it is required by some other analyzer 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/atomicalign" - "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/errorsas" - "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/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/unmarshal" - "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() { - // This suite of analyzers is applied to all code - // in GOROOT by GOROOT/src/cmd/vet/all. When adding - // a new analyzer, update the whitelist used by vet/all, - // or change its vet command to disable the new analyzer. - multichecker.Main( - // the traditional vet suite: - asmdecl.Analyzer, - assign.Analyzer, - atomic.Analyzer, - atomicalign.Analyzer, - bools.Analyzer, - buildtag.Analyzer, - cgocall.Analyzer, - composite.Analyzer, - copylock.Analyzer, - errorsas.Analyzer, - httpresponse.Analyzer, - loopclosure.Analyzer, - lostcancel.Analyzer, - nilfunc.Analyzer, - printf.Analyzer, - shift.Analyzer, - stdmethods.Analyzer, - structtag.Analyzer, - tests.Analyzer, - unmarshal.Analyzer, - unreachable.Analyzer, - unsafeptr.Analyzer, - unusedresult.Analyzer, - - // for debugging: - // findcall.Analyzer, - // pkgfact.Analyzer, - - // uses SSA: - // nilness.Analyzer, - ) -}