aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vet/main.go
AgeCommit message (Collapse)Author
2021-07-26cmd/vet: add missing copyright header180909
Change-Id: I78942dde77547f91daebe763328f52b4c476ddaf GitHub-Last-Rev: 423f1683fc7db8c1764383cf0a61c54ee21c06f2 GitHub-Pull-Request: golang/go#47334 Reviewed-on: https://go-review.googlesource.com/c/go/+/336434 Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Than McIntosh <thanm@google.com>
2021-03-08cmd/vet: bring in sigchanyzer to report unbuffered channels to signal.NotifyEmmanuel T Odeke
Brings in the static analyzer "sigchanyzer", that we created at Orijtech, Inc, and already submitted in CL 274352, as golang.org/x/tools/go/analysis/passes/sigchanyzer and add it to cmd/vet as one of the passes. Fixes #9399 Change-Id: I83708b8ea5ca8ede5ee31efab55cbce7419434ab Reviewed-on: https://go-review.googlesource.com/c/go/+/299532 Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Trust: Bryan C. Mills <bcmills@google.com>
2020-12-08cmd/vet: vendor in x/tools, enable framepointer vet checkKeith Randall
Vendor in latest x/tools. Add framepointer vet check to vet. Fixes #43014 Change-Id: Ife72f85b1261aa60c0028041c58040d60a40918a Reviewed-on: https://go-review.googlesource.com/c/go/+/276372 Trust: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
2020-11-01cmd/vet: bring in pass to catch invalid uses of testing.T in goroutinesEmmanuel T Odeke
Add "go/analysis/passes/testinggoroutine" from x/tools and vendor its source in. This pass will catch misuses of: * testing.T.Fail* * testing.T.Fatal* * testing.T.Skip* inside goroutines explicitly started by the go keyword. The pass was implemented in CL 212920. While here, found 2 misuses in: * database/sql/sql_test.go * runtime/syscall_windows_test.go and fixed them in CL 235527. Fixes #5746 Change-Id: I1740ad3f1d677bb5d78dc5d8d66bac6ec287a2b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/235677 Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2020-03-10cmd/vet: add ifaceassert and stringintconv checkssmasher164
This change re-vendors x/tools to add the ifaceassert and stringintconv checks to cmd/vet. Fixes #32479. Updates #4483. Change-Id: I6bd30b0a3278592dfab4bd247036404ddaff09e4 Reviewed-on: https://go-review.googlesource.com/c/go/+/221339 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-06-11cmd/vet: include the errors.As check from upstream x/toolsBryan C. Mills
This change revendors golang.org/x/tools to include the check and modifies cmd/vet to add it to the command. CL 179977 will enable the check by default for 'go test'. Commands run (starting in GOROOT/src): cd cmd emacs vet/main.go go get -u=patch golang.org/x/tools/go/analysis/passes/errorsas@latest go mod tidy go mod vendor cd .. ./make.bash go test all Updates #31213 Change-Id: Ic2ba9bd2d31c4c5fd9e7c42ca14e8dc38520c93b Reviewed-on: https://go-review.googlesource.com/c/go/+/181717 Reviewed-by: Jonathan Amsterdam <jba@google.com>
2019-03-11cmd: refresh cmd/vendor to match 'go mod vendor'Bryan C. Mills
This change preserves the maximum versions from cmd/vendor/vendor.json where feasible, but bumps the versions of x/sys (for CL 162987) and x/tools (for CL 162989 and CL 160837) so that 'go test all' passes in module mode when run from a working directory in src/cmd. A small change to cmd/vet (not vendored) was necessary to preserve its flag behavior given a pristine copy of x/tools; see CL 162989 for more detail. This change was generated by running 'go mod vendor' at CL 164622. (Welcoooome to the fuuuuuture!) Updates #30228 Updates #30241 Change-Id: I889590318dc857d4a6e20c3023d09a27128d8255 Reviewed-on: https://go-review.googlesource.com/c/go/+/164618 Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com>
2018-11-19cmd/go: improve go vet documentationAlan Donovan
- restore and rework cmd/vet/doc.go, which was clobbered during the vet-lite switch. - document go vet -vettool=prog flag and how to run an alternative checker. - make 'go vet -help' show how to list vet tool's flags. Example: $ go vet -help usage: go vet [-n] [-x] [-vettool prog] [build flags] [vet flags] [packages] Run 'go help vet' for details. Run 'go tool vet help' for the vet tool's flags. $ go vet -vettool=~/bin/myvet -help usage: go vet [-n] [-x] [-vettool prog] [build flags] [vet flags] [packages] Run 'go help vet' for details. Run '~/bin/myvet help' for the vet tool's flags. Updates #28840 Change-Id: Ieb79dfe29e1df074f865bc9a9d47b44199675d7d Reviewed-on: https://go-review.googlesource.com/c/147018 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-11-17cmd/vet: remove pkgfact analyzer, left in by mistakeAlan Donovan
Also, document process for updating vendored x/tools. Change-Id: I826744603ae0752e508a6db7334a2bf9adaf1289 Reviewed-on: https://go-review.googlesource.com/c/149963 Run-TryBot: Alan Donovan <adonovan@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-15cmd/vet: switch to x/tools/go/analysis implementationAlan Donovan
This change deletes the legacy implementation of vet, replacing it with a short main.go that merely selects the desired analyzers and calls into the "unitchecker" implementation vendored from golang.org/x/tools/go/analysis. Unlike the full vet checker (x/tools/go/analysis/cmd/vet), the 'lite' unitchecker cannot also be run standalone (as 'go tool vet' or cmd/vet); it must be invoked by 'go vet'. This design was chosen to avoid vendoring many additional dependencies into GOROOT, in particular go/packages. If go/packages should someday become part of the standard library, there will be considerable opportunity for simplification. This change also patches the vendored analysisflag package (by adding patch.go) so that it fully supports the build system's -V flag protocol. Also: - remove stale internal/unitchecker/ tree (belonged in https://go-review.googlesource.com/c/149778). - move vet legacy flags (-all, -v, -source, -tags) into analysisflags as all drivers will need them, not just unitchecker. I will upstream this change. A sampling of tests from the cmd/vet testsuite have been preserved as a smoke test, to ensure that each analyzer is being run, and for convenience when evaluating changes. Comprehensive tests for each analyzer live upstream in x/tools. The tests have been heavily reduced and reorganized so that they conform to the structure required by 'go vet'. Change-Id: I84b38caeef733e65deb95234b3b87b5f61046def Reviewed-on: https://go-review.googlesource.com/c/149609 Reviewed-by: Russ Cox <rsc@golang.org>
2018-11-13cmd/go: vet: pass non-.go files to vet toolAlan Donovan
The "gofiles" cache entry has been renamed "srcfiles", and it includes non-Go files (.s, .c, .cxx) that belong to the package. It does not include raw cgo files. Added regression test. Fixes #27665 Change-Id: I4884fe9b4f823f50705f8c2d357a04a8e567734f Reviewed-on: https://go-review.googlesource.com/c/148904 Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-10-17cmd/go: make go vet query cmd/vet for its flagsAlan Donovan
Add -flags flag to cmd/vet that causes it to describe its flags as JSON. go vet's "-vettool" flag has been replaced with an environment variable, GOVETTOOL, for two reasons: 1) we need its value before flag processing, because we must run vet to discover its flags. 2) users may change the env var to opt in/out of the new vet tool during the upcoming transition to vet based on the analysis API. Change-Id: I5d8f90817623022f4170b88fab3c92c9b2fbdc37 Reviewed-on: https://go-review.googlesource.com/c/142617 Run-TryBot: Alan Donovan <adonovan@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-09-26all: use strings.ReplaceAll and bytes.ReplaceAll where applicableBrad Fitzpatrick
I omitted vendor directories and anything necessary for bootstrapping. (Tested by bootstrapping with Go 1.4) Updates #27864 Change-Id: I7d9b68d0372d3a34dee22966cca323513ece7e8a Reviewed-on: https://go-review.googlesource.com/137856 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-13cmd/vet: avoid internal error for implicitly declared type switch varsRobert Griesemer
For type switches using a short variable declaration of the form switch t := x.(type) { case T1: ... go/types doesn't declare the symbolic variable (t in this example) with the switch; thus such variables are not found in types.Info.Defs. Instead they are implicitly declared with each type switch case, and can be found in types.Info.Implicits. Adjust the shadowing code accordingly. Added a test case to verify that the issue is fixed, and a test case verifying that the shadowing code now considers implicitly declared variables introduces in type switch cases. While at it, also fixed the (internal) error reporting to provide more accurate information. Fixe #26725. Change-Id: If408ed9e692bf47c640f81de8f46bf5eb43415b0 Reviewed-on: https://go-review.googlesource.com/135117 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Alan Donovan <adonovan@google.com>
2018-07-03cmd/vet: make vetx output deterministicIan Lance Taylor
The vetx output file is a build output, and as such should be deterministic. This CL changes it to not depend on map iteration order. This avoids a pointless GODEBUG=gocacheverify=1 failure. Updates #25666 Change-Id: Ic132bad134cb10938275f883c2c68432cb7c4409 Reviewed-on: https://go-review.googlesource.com/121941 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2018-06-29cmd/vet: don't run buildtag check when in vetxonly modeDaniel Martí
The check was running in the loop that read source files in, much before any of the other checks ran. Vetxonly makes vet exit early, but after all the source files have been read. To fix this, simply run the buildtag check along with all the other checks that get run on specific syntax tree nodes. Add a cmd/go test with go test -a, to ensure that the issue as reported is fixed. Fixes #26102. Change-Id: If6e3b9418ffa8166c0f982668b0d10872283776a Reviewed-on: https://go-review.googlesource.com/121395 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-11cmd/vet: add support for vet-specific export dataRuss Cox
An upcoming change to cmd/go will enable this functionality, which allows vet to write down information about one package for use by later invocation of vet that analyze code importing that package. We've intended to do this for a long time, but the build caching was necessary to have a decent way to manage the vet-specific export data. This is also an experiment in building scalable whole-program analyses. In the long term we'd like to allow other analyses to be invoked this way. Change-Id: I34e4b70445786b2e8707ff6a0c00947bf1491511 Reviewed-on: https://go-review.googlesource.com/117099 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-05-29cmd/vet: avoid false positives with non-commentsDaniel Martí
vet's buildtag check looks for malformed build tag comments. Since these can appear in Go files as well as non-Go files (such as assembly files), it must read the file line by line instead of using go/token or go/ast directly. However, this method runs into false positives if there are any lines in the code that look like comments, but are not. For example: $ cat f.go package main const foo = ` //+build ignore ` $ go vet f.go ./f.go:3: +build comment must appear before package clause and be followed by a blank line This bug has been popping up more frequently since vet started being run with go test, so it is important to make the check as precise as possible. To avoid the false positive, when checking a Go file, cross-check that a line that looks like a comment actually corresponds to a comment in the go/ast syntax tree. Since vet already obtains the syntax trees for all the Go files, it checks, this change means very little extra work for the check. While at it, add a badf helper function to simplify the code that reports warnings in the buildtag check. Fixes #13533. Change-Id: I484a16da01363b409ec418c313634171bf85250b Reviewed-on: https://go-review.googlesource.com/111415 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-05-24cmd/go, cmd/vet, go/internal/gccgoimport: make vet work with gccgoIan Lance Taylor
When using gccgo/GoLLVM, there is no package file for a standard library package. Since it is impossible for the go tool to rebuild the package, and since the package file exists only in the form of a .gox file, this seems like the best choice. Unfortunately it was confusing vet, which wanted to see a real file. This caused vet to report errors about missing package files for standard library packages. The gccgoimporter knows how to correctly handle this case. Fix this by 1) telling vet which packages are standard; 2) letting vet skip those packages; 3) letting the gccgoimporter handle this case. As a separate required fix, gccgo/GoLLVM has no runtime/cgo package, so don't try to depend on it (as it happens, this fixes #25324). The result is that the cmd/go vet tests pass when using -compiler=gccgo. Fixes #25324 Change-Id: Iba8f948fe944da5dc674f580bd3321929ee50fa0 Reviewed-on: https://go-review.googlesource.com/113716 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-30cmd/vet: **T is not Stringer if *T has a String methodDaniel Martí
vet recorded what types had String methods defined on them, but it did not record whether the receivers were pointer types. That information is important, as the following program is valid: type T string func (t *T) String() string { return fmt.Sprint(&t) // prints address } Teach vet that, if *T is Stringer, **T is not. Fixes #23550. Change-Id: I1062e60e6d82e789af9cca396546db6bfc3541e8 Reviewed-on: https://go-review.googlesource.com/90417 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2017-12-14cmd/vet: limit printf check to known Printf-like functionsRuss Cox
The name-based heuristics fail too often to be on during "go test", but we really want the printf vet check in "go test", so change to a list of exactly which standard library functions are print-like. For a later release we'd like to bring back checking for user-defined wrappers, but in a completely precise way. Not for Go 1.10, though. The new, more precise list includes t.Skipf, which caught some mistakes in standard library tests. Fixes #22936. Change-Id: I110448e3f6b75afd4327cf87b6abb4cc2021fd0d Reviewed-on: https://go-review.googlesource.com/83838 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-12-01cmd/go: ignore vet typecheck failure during go testRuss Cox
For Go 1.10, works around a go/types bug that can't typecheck a corner-case type cycle. Once we are confident that bugs like this are gone from go/types then we can stop ignoring these failures. For #22890. Change-Id: I38da57e01a0636323e1af4484c30871786125df3 Reviewed-on: https://go-review.googlesource.com/81500 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-03cmd/go: run vet automatically during go testRuss Cox
This CL adds an automatic, limited "go vet" to "go test". If the building of a test package fails, vet is not run. If vet fails, the test is not run. The goal is that users don't notice vet as part of the "go test" process at all, until vet speaks up and says something important. This should help users find real problems in their code faster (vet can just point to them instead of needing to debug a test failure) and expands the scope of what kinds of things vet can help with. The "go vet" runs in parallel with the linking of the test binary, so for incremental builds it typically does not slow the overall "go test" at all: there's spare machine capacity during the link. all.bash has less spare machine capacity. This CL increases the time for all.bash on my laptop from 4m41s to 4m48s (+2.5%) To opt out for a given run, use "go test -vet=off". The vet checks used during "go test" are a subset of the full set, restricted to ones that are 100% correct and therefore acceptable to make mandatory. In this CL, that set is atomic, bool, buildtags, nilfunc, and printf. Including printf is debatable, but I want to include it for now and find out what needs to be scaled back. (It already found one real problem in package os's tests that previous go vet os had not turned up.) Now that we can rely on type information it may be that printf should make its function-name-based heuristic less aggressive and have a whitelist of known print/printf functions. Determining the exact set for Go 1.10 is #18085. Running vet also means that programs now have to type-check with both cmd/compile and go/types in order to pass "go test". We don't start vet until cmd/compile has built the test package, so normally the added go/types check doesn't find anything. However, there is at least one instance where go/types is more precise than cmd/compile: declared and not used errors involving variables captured into closures. This CL includes a printf fix to os/os_test.go and many declared and not used fixes in the race detector tests. Fixes #18084. Change-Id: I353e00b9d1f9fec540c7557db5653e7501f5e1c9 Reviewed-on: https://go-review.googlesource.com/74356 Run-TryBot: Russ Cox <rsc@golang.org> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org>
2017-11-01cmd/vet: accept package config from go commandRuss Cox
This CL adds support for accepting package config from the go command. Paired with CL 74356 this lets us make sure vet has complete information about package sources. This fixes many issues (see CL 74356 for the list), including mishandling of cgo and vendoring. Change-Id: Ia4a1dce6f9b1b0a8ef5fdf9005a20a8b294969f1 Reviewed-on: https://go-review.googlesource.com/74355 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2017-10-02cmd/vet: in rangeloop check, inspect for loop variables tooAlan Donovan
+ Test. Change-Id: I42eaea1c716217f7945c008ff4bde6de14df5687 Reviewed-on: https://go-review.googlesource.com/34619 Reviewed-by: Robert Griesemer <gri@golang.org>
2017-09-07cmd/vet: remove two unused parameters and simplifyDaniel Martí
The isStar and directory function parameters have been unused ever since they were introduced. Remove them. While at it, apply some other minor simplifications, such as simplifying a HasPrefix if and using an early continue to unindent many lines of code. Change-Id: I8d57353e9ec10cdb59c5388cf6152ce0ec17bdba Reviewed-on: https://go-review.googlesource.com/62030 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Marvin Stenger <marvin.stenger94@gmail.com>
2017-08-03cmd/vet: don't exit with failure on type checking errorIan Lance Taylor
The vet tool only reports a type checking error when invoked with -v. Don't let that by itself cause vet to exit with an error exit status. Updates #21188 Change-Id: I172c13d46c35d49e229e96e833683d8c82a77de7 Reviewed-on: https://go-review.googlesource.com/52851 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Rob Pike <r@golang.org>
2017-04-19cmd/vet: skip unreachable "if" and "case" code in shift check.Aliaksandr Valialkin
Such dead code is legitimate when dealing with arch-specific types (int, uint, uintptr). The CL removes the majority of 'too small for shift' false positives from such a code. Change-Id: I62c5635a1d3774ab2d71d3d7056f0589f214cbe5 Reviewed-on: https://go-review.googlesource.com/38065 Run-TryBot: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2017-04-10cmd/go: allow full flag processing in go vetRob Pike
This allows the go tool to run "go vet" with both the build flags that make sense, such as -x and -tags, and vet with all its flags. To do this, create a new package cmd/go/internal/cmdflag to hold functionality common to flag handling for test and vet. Fixes #19350 RELNOTES=yes Change-Id: Ia1ae213bd3f6cab1c5e492501c8d43ce61a7ee89 Reviewed-on: https://go-review.googlesource.com/40112 Reviewed-by: Russ Cox <rsc@golang.org>
2017-03-02cmd/vet: support importing from sourceJosh Bleecher Snyder
Add a -source flag to cmd/vet that instructs it to typecheck purely from source code. Updates #16086 Fixes #19332 Change-Id: Ic83d0f14d5bb837a329d539b2873aeccdf7bf669 Reviewed-on: https://go-review.googlesource.com/37690 Reviewed-by: Rob Pike <r@golang.org>
2016-10-25cmd/vet: accept space-separated tag lists for compatibility with cmd/goRuss Cox
Fixes #17148. Change-Id: I4c66aa0733c249ee6019d1c4e802a7e30457d4b6 Reviewed-on: https://go-review.googlesource.com/32030 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2016-10-13cmd/vet: check for duplicate json, xml struct field tagsAlex Browne
It is easy to make the mistake of duplicating json struct field tags especially when copy/pasting. This commit causes go vet to report the mistake. Only field tags in the same struct type are considered, because that is the only case which is undoubtedly an error. Fixes #12791. Change-Id: I4130e4c04b177694cc0daf8f1acaf0751d4f062b Reviewed-on: https://go-review.googlesource.com/16704 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2016-09-19cmd/vet: hard-code program name in usage messageTormod Erevik Lea
Example on linux_amd64 for 'go tool vet -h': Before: Usage of /usr/local/go/pkg/tool/linux_amd64/vet: After: Usage of vet: Change-Id: I11cb16b656bd097062d57a8c7441fbe66caaef78 Reviewed-on: https://go-review.googlesource.com/29294 Reviewed-by: Rob Pike <r@golang.org>
2016-08-22cmd/vet: clean up printing errors with no positionJosh Bleecher Snyder
Before: : runtime/asm_amd64.s:345: [amd64] morestack: use of 8(SP) points beyond argument frame After: runtime/asm_amd64.s:345: [amd64] morestack: use of 8(SP) points beyond argument frame Updates #11041 Change-Id: Ic87a6d1a2a7b2a8bf737407bc981b159825c84f2 Reviewed-on: https://go-review.googlesource.com/27152 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2016-06-28cmd/vet: make checking example names in _test packages more robustKonstantin Shaposhnikov
Prior to this change package "foo" had to be installed in order to check example names in "foo_test" package. However by the time "foo_test" package is checked a parsed "foo" package has been already constructed. Use it to check example names. Also change TestDivergentPackagesExamples test to pass directory of the package to the vet tool as it is the most common way to invoke it. This requires changes to errchk to add support for grabbing source files from a directory. Fixes #16189 Change-Id: Ief103d07b024822282b86c24250835cc591793e8 Reviewed-on: https://go-review.googlesource.com/24488 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-11cmd/vet: improve documentation for flags, slightlyRob Pike
The way that -all works was unclear from the documentation and made worse by recent changes to the flag package. Improve matters by making the help message say "default true" for the tests that do default to true, and tweak some of the wording. Before: Usage of vet: vet [flags] directory... vet [flags] files... # Must be a single package For more information run go doc cmd/vet Flags: -all enable all non-experimental checks (default unset) -asmdecl check assembly against Go declarations (default unset) ... After: Usage of vet: vet [flags] directory... vet [flags] files... # Must be a single package By default, -all is set and all non-experimental checks are run. For more information run go doc cmd/vet Flags: -all enable all non-experimental checks (default true) -asmdecl check assembly against Go declarations (default true) ... Change-Id: Ie94b27381a9ad2382a10a7542a93bce1d59fa8f5 Reviewed-on: https://go-review.googlesource.com/21495 Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-03-23cmd/vet: check lock copy in function calls and return statementsAliaksandr Valialkin
Fixes #14529 Change-Id: I6ed059d279ba0fe12d76416859659f28d61781d2 Reviewed-on: https://go-review.googlesource.com/20832 Run-TryBot: Rob Pike <r@golang.org> Reviewed-by: Rob Pike <r@golang.org>
2016-03-17cmd/pack,vet: use `go doc` instead of `godoc` in docHyang-Ah Hana Kim
Change-Id: Ic5f62a7d0a5c090da69213d1d0187af0ea48e358 Reviewed-on: https://go-review.googlesource.com/20820 Reviewed-by: Rob Pike <r@golang.org>
2016-03-07cmd/vet: remove -test flagKonstantin Shaposhnikov
-test flag is a testing only flag that enables all vet checks. It was needed because there was no way to run all vet checks in a single command invocation. However it is possible to do this now by combining -all and -shadow flags. Also a recently added -tests flag is similarly named, having both -test and -tests can be confusing. Change-Id: Ie5bacbe0bef5c8409eeace46f16141fa4e782c32 Reviewed-on: https://go-review.googlesource.com/20006 Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-03-02cmd/vet: polish output of shadow testMarvin Stenger
This commit modifies the style of a error message in case of -shadow. Previously such a message would look like: foo.go:42: declaration of err shadows declaration at shadow.go:13: Changes of the commit include highlighting the variable name and removing the ": "(space intended) at the end of the line: foo.go:42: declaration of "err" shadows declaration at shadow.go:13 Fixes #14585. Change-Id: Ia6a6bf396668dcba9a24f025a08d8826db31f434 Reviewed-on: https://go-review.googlesource.com/20093 Reviewed-by: Rob Pike <r@golang.org>
2016-03-02all: single space after period.Brad Fitzpatrick
The tree's pretty inconsistent about single space vs double space after a period in documentation. Make it consistently a single space, per earlier decisions. This means contributors won't be confused by misleading precedence. This CL doesn't use go/doc to parse. It only addresses // comments. It was generated with: $ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])') $ go test go/doc -update Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7 Reviewed-on: https://go-review.googlesource.com/20022 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Dave Day <djd@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-12-05cmd/vet: make "-all -shadow" mean all default checks and -shadowKonstantin Shaposhnikov
Prior to this change "go tool vet -all -shadow" ran only -shadow check. Also fix godoc package path in the usage text. Fixes #13020 Change-Id: I87c60d6b06a02106ae8bff56adb79df032cc4646 Reviewed-on: https://go-review.googlesource.com/16325 Reviewed-by: Russ Cox <rsc@golang.org>
2015-09-21cmd/vet: copy changes from golang.org/x/tools to cmd/vetRob Pike
This means bringing over the examples flag and sorting doc.go. Subsequent changes will generalize the examples flag to a general test naming flag, but let's start with the original code. No more changes to golang.org/x/tools please. This should not have happened (and letting it happen was partly my fault). Change-Id: Ia879ea1d15d82372df14853f919263125dfb7b96 Reviewed-on: https://go-review.googlesource.com/14821 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-04cmd/vet: adjust vet to use go/types and friends from std repoRobert Griesemer
- s|"golang.org/x/tools/go/exact"|"go/constant"| - s|"golang.org/x/tools/go/types"|"go/types"| - removed import of gcimporter - import "go/importer" instead - trivial adjustments to make use of go/importer - adjusted import paths for whitelist.go Change-Id: I43488ff44c329cd869c92dcc31193fb31bebfd29 Reviewed-on: https://go-review.googlesource.com/10695 Reviewed-by: Rob Pike <r@golang.org>
2015-06-04cmd/vet: move cmd/vet into std repoRobert Griesemer
cp -r x/tools/cmd/vet cmd/vet without any changes. The next change will adjust the source to use std repo go/types and friends. This may (temporarily) break the build; the next commit (immediately following) will fix it. We do it in two commits so that we can see the manual changes. Change-Id: Ic45dab7066f13923e21f8c61200c8c3fd447b171 Reviewed-on: https://go-review.googlesource.com/10694 Reviewed-by: Rob Pike <r@golang.org>
2013-05-17cmd/vet: delete; it now lives in the go.tools subrepoRob Pike
R=golang-dev, dsymonds, rsc, iant, dave CC=golang-dev https://golang.org/cl/9496043
2013-05-14cmd/vet: fix for changes to go/types packageRob Pike
Need to use (or stub) exact.Value. R=gri CC=golang-dev https://golang.org/cl/9126043
2013-03-22cmd/vet: diagnose unreachable codeRuss Cox
R=golang-dev, r CC=golang-dev https://golang.org/cl/7493048
2013-03-22cmd/vet: add assembly checkerRuss Cox
Fixes #5036. R=golang-dev, r CC=golang-dev https://golang.org/cl/7531045
2013-03-06cmd/vet: isolate the type checking code into a separate fileRob Pike
We can enable/disable type checking with a build tag. Should simplify cutting the go1.1 distribution free of go/types. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7482045