1
0
mirror of https://github.com/golang/go synced 2024-10-04 01:31:25 -06:00
Commit Graph

30 Commits

Author SHA1 Message Date
Rob Pike
4434212f15 cmd/vet: use types to test Error methods correctly.
We need go/types to discriminate the Error method from
the error interface and the Error method of the testing package.
Fixes #4753.

R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/7396054
2013-02-22 17:16:31 -08:00
Rob Pike
48f79a95d0 cmd/vet: restructure to be package-driven
This is a simple refactoring of main.go that will enable the type checker
to be used during vetting.
The change has an unimportant effect on the arguments: it now assumes
that all files named explicitly on the command line belong to the same
package. When run by the go command, this was true already.

Also restore a missing parenthesis from an error message.

R=golang-dev, gri, bradfitz
CC=golang-dev
https://golang.org/cl/7393052
2013-02-22 13:32:43 -08:00
Robert Griesemer
3ee87d02b0 cmd/godoc: use go/build to determine package and example files
Also:
- faster code for example extraction
- simplify handling of command documentation:
  all "main" packages are treated as commands
- various minor cleanups along the way

For commands written in Go, any doc.go file containing
documentation must now be part of package main (rather
then package documentation), otherwise the documentation
won't show up in godoc (it will still build, though).

For commands written in C, documentation may still be
in doc.go files defining package documentation, but the
recommended way is to explicitly ignore those files with
a +build ignore constraint to define package main.

Fixes #4806.

R=adg, rsc, dave, bradfitz
CC=golang-dev
https://golang.org/cl/7333046
2013-02-19 11:19:58 -08:00
Russ Cox
7f284f85f9 cmd/vet: drop column information from error
The column information can be misleading.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/7300100
2013-02-13 22:34:37 -05:00
Rob Pike
d282532901 vet: improve flag handling
Simplify the internal logic for flags controlling what to vet,
by introducing a map of flags that gathers them all together.
This change should simplify the process of adding further flags.

Add a test for untagged struct literals.
Delete a redundant test that was also in the wrong file.
Clean up some ERROR patterns that weren't working.

"make test" passes again.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7305075
2013-02-11 13:33:11 -08:00
Brad Fitzpatrick
e515d80d5d bytes, strings: add TrimPrefix and TrimSuffix
Everybody either gets confused and thinks this is
TrimLeft/TrimRight or does this by hand which gets
repetitive looking.

R=rsc, kevlar
CC=golang-dev
https://golang.org/cl/7239044
2013-02-01 08:41:25 -08:00
Russ Cox
c0e805efd2 cmd/vet: add missing -all logic
R=golang-dev, cookieo9, bradfitz
CC=golang-dev
https://golang.org/cl/7260043
2013-01-31 14:37:47 -08:00
Russ Cox
739aa6b1ba cmd/vet: check for misplaced and malformed build tags
Fixes #4184.

R=golang-dev, bradfitz, minux.ma, cookieo9
CC=golang-dev
https://golang.org/cl/7251044
2013-01-31 13:52:27 -08:00
Russ Cox
87c3c1b002 cmd/vet: handle added string constants in printf format check
Fixes #4599.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/7226067
2013-01-31 07:53:38 -08:00
Rodrigo Rafael Monti Kochenburger
6073176512 cmd/vet: detect misuse of atomic.Add*
Re-assigning the return value of an atomic operation to the same variable being operated is a common mistake:

x = atomic.AddUint64(&x, 1)

Add this check to go vet.

Fixes #4065.

R=dvyukov, golang-dev, remyoudompheng, rsc
CC=golang-dev
https://golang.org/cl/7097048
2013-01-30 07:57:11 -08:00
Shenghou Ma
e487ea8421 cmd/vet: don't complain about Error()
Fixes #4598.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/7102050
2013-01-18 02:24:12 +08:00
Jason Travis
f7320bf81b cmd/vet: fix doc typo.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/7061050
2013-01-08 15:22:18 +11:00
David Symonds
86aad668c0 cmd/vet: %#q is a valid format (uses raw quotes).
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7057051
2013-01-07 15:31:51 +11:00
David Symonds
bb57670470 cmd/vet: expand printf flags understood by %s and %q.
Fixes #4580.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7002043
2012-12-21 13:48:36 +11:00
Shenghou Ma
d1ef9b56fb all: fix typos
caught by https://github.com/lyda/misspell-check.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/6949072
2012-12-19 03:04:09 +08:00
David Symonds
82f2b36e74 vet: be less strict about number of arguments when a ... is present.
R=golang-dev
CC=golang-dev
https://golang.org/cl/6883046
2012-12-06 15:17:31 +11:00
Robert Griesemer
465b9c35e5 gofmt: apply gofmt -w src misc
Remove trailing whitespace in comments.
No other changes.

R=r
CC=golang-dev
https://golang.org/cl/6815053
2012-10-30 13:38:01 -07:00
David Symonds
5a93fea08e vet: fix rangeloop.
In a range loop, the presence of a value implies the presence of a key.
However, the presence of a value as an *ast.Ident does not imply that
the key is also an *ast.Ident, thus leading to a panic any time the
two argument form is used where the key is not an identifier.

R=golang-dev, adg, r
CC=golang-dev
https://golang.org/cl/6540045
2012-09-20 08:12:47 +10:00
Andrew Gerrand
51e85612f9 vet: add range variable misuse detection
R=fullung, r, remyoudompheng, minux.ma, gri, rsc
CC=golang-dev
https://golang.org/cl/6494075
2012-09-18 14:19:31 -07:00
Rob Pike
f49b7b0acf cmd/vet: provide flags to control which tests to run
By default, all are still run, but a particular test can be
selected with the new flags.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6395053
2012-07-16 14:03:11 -07:00
Rob Pike
97a7defed4 vet: check values for named constants as well as literals.
As in:
        const format = "%s"
        fmt.Printf(format, "hi")
Also fix a couple of bugs by rewriting the routine.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6099057
2012-04-25 12:14:38 +10:00
David Symonds
2e1bc9e867 cmd/vet: little tweak to tagged literal script to get it closer to drop-in format.
This is a minor change that made it easier for me; if you hate it I can drop it.

R=nigeltao
CC=golang-dev
https://golang.org/cl/5798060
2012-03-12 13:50:25 +11:00
Jeremy Jackins
1e374502f4 cmd/vet: fix typo in documentation
familiy -> family

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5783061
2012-03-09 11:21:01 -08:00
Shenghou Ma
df3a841021 doc: elaborate available checks for cmd/vet
R=golang-dev, r, ality, r
CC=golang-dev
https://golang.org/cl/5709053
2012-03-01 02:22:35 +08:00
Shenghou Ma
04f110e530 cmd/vet: don't give error for Printf("%+5.2e", x)
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5696048
2012-02-25 01:16:17 +08:00
Shenghou Ma
60e4d5668e cmd/vet: give warning for construct 'Println(os.Stderr, ...)'
also fixes this bug in net/http/httptest.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5654083
2012-02-14 11:24:41 -05:00
Nigel Tao
9de9c95787 vet: add a check for untagged struct literals.
R=rsc, dsymonds
CC=golang-dev, gri
https://golang.org/cl/5622045
2012-02-03 14:33:41 +11:00
Nigel Tao
df7f34dd2b vet: fix comment typo.
R=rsc, gri
CC=golang-dev
https://golang.org/cl/5620049
2012-02-02 17:53:28 +11:00
Russ Cox
2050a9e478 build: remove Make.pkg, Make.tool
Consequently, remove many package Makefiles,
and shorten the few that remain.

gomake becomes 'go tool make'.

Turn off test phases of run.bash that do not work,
flagged with $BROKEN.  Future CLs will restore these,
but this seemed like a big enough CL already.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5601057
2012-01-30 23:43:46 -05:00
Rob Pike
71d83b72ef cmd/go: add go tools to rearrangement
fix, vet
yacc is also fixed (it was wrong before)
All that's left is the commands used during compilation
This looks like a huge CL, but it's almost all file renames.
The action is in cmd/go/pkg.go, the Makefiles, and .../doc.go.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5595044
2012-01-29 11:07:25 -08:00