From d1f8dbfb0b0b6546bb10eb272220fab84b83bc61 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Mon, 19 Nov 2018 12:28:29 -0500 Subject: [PATCH] go/analysis/cmd/vet-lite: remove MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The vet-lite tool was useful for developing the new cmd/vet but no longer needs to exist. This changes removes the command and moves the main.go file to the unitchecker directory where it serves as an example and can still be built for testing and debugging. See also https://go-review.googlesource.com/c/go/+/150297. Change-Id: Ic10c7cd3aeeaa2e1397dd81939616c6877f7005d Reviewed-on: https://go-review.googlesource.com/c/150298 Reviewed-by: Michael Matloob Reviewed-by: Daniel Martí --- go/analysis/internal/analysisflags/help.go | 2 +- .../{cmd/vet-lite => unitchecker}/main.go | 26 ++++++------------- 2 files changed, 9 insertions(+), 19 deletions(-) rename go/analysis/{cmd/vet-lite => unitchecker}/main.go (64%) diff --git a/go/analysis/internal/analysisflags/help.go b/go/analysis/internal/analysisflags/help.go index 66aa624572..043b97896d 100644 --- a/go/analysis/internal/analysisflags/help.go +++ b/go/analysis/internal/analysisflags/help.go @@ -18,7 +18,7 @@ string. It uses heuristics that do not guarantee all reports are genuine problems, but it can find errors not caught by the compilers. ` -// Help implements the help subcommand for a multichecker or vet-lite +// Help implements the help subcommand for a multichecker or unitchecker // style command. The optional args specify the analyzers to describe. // Help calls log.Fatal if no such analyzer exists. func Help(progname string, analyzers []*analysis.Analyzer, args []string) { diff --git a/go/analysis/cmd/vet-lite/main.go b/go/analysis/unitchecker/main.go similarity index 64% rename from go/analysis/cmd/vet-lite/main.go rename to go/analysis/unitchecker/main.go index 259d3976b4..844e8f3dac 100644 --- a/go/analysis/cmd/vet-lite/main.go +++ b/go/analysis/unitchecker/main.go @@ -1,7 +1,12 @@ -// The vet-lite command is a driver for static checkers conforming to -// the golang.org/x/tools/go/analysis API. It must be run by go vet: +// +build ignore + +// This file provides an example command for static checkers +// conforming to the golang.org/x/tools/go/analysis API. +// It serves as a model for the behavior of the cmd/vet tool in $GOROOT. +// Being based on the unitchecker driver, it must be run by go vet: // -// $ go vet -vettool=$(which vet-lite) +// $ go build -o unitchecker main.go +// $ go vet -vettool=unitchecker my/project/... // // For a checker also capable of running standalone, use multichecker. package main @@ -32,21 +37,6 @@ import ( "golang.org/x/tools/go/analysis/passes/unusedresult" ) -// Legacy vet had the concept of "experimental" checkers. There -// was exactly one, shadow, and it had to be explicitly enabled -// by the -shadow flag, which would of course disable all the -// other tristate flags, requiring the -all flag to reenable them. -// (By itself, -all did not enable all checkers.) -// The -all flag is no longer needed, so it is a no-op. -// -// The shadow analyzer has been removed from the suite, -// but can be run using these additional commands: -// $ go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow -// $ go vet -vettool=$(which shadow) -// Alternatively, one could build a multichecker containing all -// the desired checks (vet's suite + shadow) and run it in a -// single "go vet" command. - func main() { unitchecker.Main( asmdecl.Analyzer,