]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/vendor: eliminate vet-lite
authorAlan Donovan <adonovan@google.com>
Mon, 19 Nov 2018 17:25:37 +0000 (12:25 -0500)
committerAlan Donovan <adonovan@google.com>
Mon, 19 Nov 2018 17:33:37 +0000 (17:33 +0000)
cmd/vet, now simplified to a single function call is now authoritative,
not a copy of vet-lite.

The update-xtools.sh script now uses the imports of cmd/vet as the
roots for vendoring.

Change-Id: I4faef3fcf3db10b3a3930726e8d0720a3c8395da
Reviewed-on: https://go-review.googlesource.com/c/150297
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
src/cmd/vendor/golang.org/x/tools/go/analysis/cmd/vet-lite/main.go [deleted file]
src/cmd/vendor/update-xtools.sh

diff --git a/src/cmd/vendor/golang.org/x/tools/go/analysis/cmd/vet-lite/main.go b/src/cmd/vendor/golang.org/x/tools/go/analysis/cmd/vet-lite/main.go
deleted file mode 100644 (file)
index 259d397..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// 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:
-//
-//   $ go vet -vettool=$(which vet-lite)
-//
-// For a checker also capable of running standalone, use multichecker.
-package main
-
-import (
-       "golang.org/x/tools/go/analysis/unitchecker"
-
-       "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/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"
-)
-
-// 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,
-               assign.Analyzer,
-               atomic.Analyzer,
-               bools.Analyzer,
-               buildtag.Analyzer,
-               cgocall.Analyzer,
-               composite.Analyzer,
-               copylock.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,
-       )
-}
index 0097a729918a34cd8bc69f4dfb017d77b99cd634..8cf5ac165df4aa575a88970c9296e4832e0dbac0 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # update-xtools.sh: idempotently update the vendored
-# copy of the x/tools repository used by vet-lite.
+# copy of the x/tools repository used by cmd/vet.
 
 set -u
 
@@ -11,7 +11,11 @@ xtools=$(dirname $(dirname $analysis))
 
 vendor=$(dirname $0)
 
-go list -f '{{.ImportPath}} {{.Dir}}' -deps golang.org/x/tools/go/analysis/cmd/vet-lite |
+# Find the x/tools packages directly imported by cmd/vet.
+go list -f '{{range $k, $v := .ImportMap}}{{$k}} {{end}}' cmd/vet |
+  grep golang.org/x/tools |
+  # Vendor their transitive closure of dependencies.
+  xargs go list -f '{{.ImportPath}} {{.Dir}}' -deps |
   grep golang.org/x/tools |
   while read path dir
   do
@@ -23,5 +27,5 @@ go list -f '{{.ImportPath}} {{.Dir}}' -deps golang.org/x/tools/go/analysis/cmd/v
 
 echo "Copied $xtools@$(cd $analysis && git rev-parse --short HEAD) to $vendor" >&2
 
-go build -o /dev/null ./golang.org/x/tools/go/analysis/cmd/vet-lite ||
-  { echo "Failed to build vet-lite"; exit 1; } >&2
+go build -o /dev/null cmd/vet ||
+  { echo "Failed to build cmd/vet"; exit 1; } >&2