1
0
mirror of https://github.com/golang/go synced 2024-11-12 12:30:21 -07:00
Commit Graph

177 Commits

Author SHA1 Message Date
Josh Bleecher Snyder
2f5aea7c13 Revert "Revert "cmd/vet/all: remove pprof from the whitelist""
This reverts commit 9bd1cc3fa1.

Reason for revert: New fixes in from upstream. Try this again.

Change-Id: Iea46f32857e8467f8d5a49b31e20a52fda8bce60
Reviewed-on: https://go-review.googlesource.com/37693
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-02 19:10:21 +00:00
Josh Bleecher Snyder
85bae0a9df cmd/vet/all: remove printf hacks
Now that vet loads from source,
fmt can always be correctly resolved,
so the fmt.Formatter type is always available,
so we can reinstate the check.

Change-Id: I17f0c7fccf6960c9415de8774b15123135d57be8
Reviewed-on: https://go-review.googlesource.com/37692
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-02 18:43:40 +00:00
Josh Bleecher Snyder
8a93546d68 cmd/vet/all: vet using only source
This simplifies the code and speeds it up.
It also allows us to eliminate some other TODOs;
those will come in a follow-up CL.

Running for the host platform, before:

real	0m9.907s
user	0m14.566s
sys	0m1.058s

After:

real	0m7.841s
user	0m12.339s
sys	0m0.572s

Running for a single non-host platform, before:

real	0m8.784s
user	0m15.451s
sys	0m3.445s

After:

real	0m7.681s
user	0m12.122s
sys	0m0.577s

Running for all platforms, before:

real	7m4.480s
user	8m43.398s
sys	1m15.683s

After:

real	4m37.596s
user	7m30.729s
sys	0m18.533s

It also makes my laptop considerably more
responsive while running for all platforms.

Change-Id: I748689fea0d2d4ef61aca2ce5524d03d8fafa5ca
Reviewed-on: https://go-review.googlesource.com/37691
Reviewed-by: Rob Pike <r@golang.org>
2017-03-02 18:43:33 +00:00
Josh Bleecher Snyder
ddbee9abd4 cmd/vet: support importing from source
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>
2017-03-02 18:43:23 +00:00
Josh Bleecher Snyder
7e74d43291 cmd/vet: refactor to support alternative importers
Instead of constructing the importer in init, do it lazily as needed.
This lets us select the importer using a command line flag.
The addition of the command line flag will come in a follow-up CL.

Change-Id: Ieb3a5f01a34fb5bd220a95086daf5d6b37e83bb5
Reviewed-on: https://go-review.googlesource.com/37669
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-02 18:43:12 +00:00
Josh Bleecher Snyder
3d77bc081d cmd/vet/all: use SizesFor to calculate archbits
Change-Id: I99706807782f11e8d24baf953424a9e292a2cbac
Reviewed-on: https://go-review.googlesource.com/37668
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-02 17:13:44 +00:00
Josh Bleecher Snyder
99fbccbd93 cmd/vet: use types.SizesFor
This eliminates a duplicate copy of
the SizesFor map.

Change-Id: I51e44ea8ee860901086616e3f4dfa32aaa9b4d2d
Reviewed-on: https://go-review.googlesource.com/37667
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-02 17:13:36 +00:00
Josh Bleecher Snyder
9bd1cc3fa1 Revert "cmd/vet/all: remove pprof from the whitelist"
This reverts commit 12b6c18139.

Reason for revert: Broke vet builder. #19322 was not fully fixed.

Change-Id: Id85131d4d0b8915480d65e3532da62b769463d70
Reviewed-on: https://go-review.googlesource.com/37625
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2017-03-01 13:29:39 +00:00
Brad Fitzpatrick
12b6c18139 cmd/vet/all: remove pprof from the whitelist
Updates #19322

Change-Id: I610f40d874f499e52db3356a3da54538dac55242
Reviewed-on: https://go-review.googlesource.com/37618
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2017-03-01 00:38:39 +00:00
Josh Bleecher Snyder
09294ab754 cmd/vet/all: disable cgo when running 'go install'
Change-Id: Iab1e84624c0288ebdd33fbe83bd60948b5d91fc4
Reviewed-on: https://go-review.googlesource.com/37612
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-28 23:25:22 +00:00
Josh Bleecher Snyder
d3d2a67c13 cmd/vet/all: temporarily ignore vendored pprof
Change-Id: I3d96b9803dbbd7184f96240bd7944af919ca1376
Reviewed-on: https://go-review.googlesource.com/37579
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-28 19:16:05 +00:00
Josh Bleecher Snyder
d99d5f7caa cmd/vet: allow shifts by amounts calculated using unsafe
The real world code that inspired this fix,
from runtime/pprof/map.go:

	// Compute hash of (stk, tag).
	h := uintptr(0)
	for _, x := range stk {
		h = h<<8 | (h >> (8 * (unsafe.Sizeof(h) - 1)))
		h += uintptr(x) * 41
	}
	h = h<<8 | (h >> (8 * (unsafe.Sizeof(h) - 1)))
	h += uintptr(tag) * 41

Change-Id: I99a95b97cba73811faedb0b9a1b9b54e9a1784a3
Reviewed-on: https://go-review.googlesource.com/37574
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-28 19:13:18 +00:00
Josh Bleecher Snyder
016569f204 cmd/vet/all: move suspicious shift whitelists to 64 bit
This is an inconsequential consequence of updating
math/big to use math/bits.

Better would be to teach the vet shift test
to size int/uint/uintptr to the platform in use,
eliminating the whole category of "might be too small".
Filed #19321 for that.

Change-Id: I7e0b837bd329132d7a564468c18502dd2e724fc6
Reviewed-on: https://go-review.googlesource.com/37576
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-28 19:12:00 +00:00
Josh Bleecher Snyder
8defd9f708 cmd/vet/all: exit with non-zero error code on failure
Change-Id: I68e60b155c583fa47aa5ca13d591851009a4e571
Reviewed-on: https://go-review.googlesource.com/37571
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-28 18:10:01 +00:00
Josh Bleecher Snyder
731fd009f0 cmd/vet/all: use -dolinkobj=false to speed up runs
When running on the host platform,
the standard library has almost certainly already been built.
However, all other platforms will probably need building.
Use the new -dolinkobj=false flag to cmd/compile
to only build the export data instead of doing a full compile.

Having partial object files could be confusing for people
doing subsequent cross-compiles, depending on what happens with #18369.
However, cmd/vet/all will mainly be run by builders
and core developers, who are probably fairly well-placed
to handle any such confusion.

This reduces the time on my machine for a cold run of
'go run main.go -all' by almost half:

benchmark           old ns/op        new ns/op        delta
BenchmarkVetAll     240670814551     130784517074     -45.66%

Change-Id: Ieb866ffb2cb714b361b0a6104077652f8eacd166
Reviewed-on: https://go-review.googlesource.com/37385
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-23 07:12:48 +00:00
Josh Bleecher Snyder
2774085bdc cmd/vet/all: update windows whitelist
A last-minute rollback of a change left some
unreachable code that we don't want to remove.

Change-Id: Ida0af5b18ed1a2e13ef66c303694afcc49d7bff4
Reviewed-on: https://go-review.googlesource.com/37304
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-21 18:42:16 +00:00
Josh Bleecher Snyder
ea52f4b374 cmd/vet/all: update whitelists for monotonic time changes
Change-Id: Ib942cb9e0cb20821aea4274bc3ddc83a215afbcb
Reviewed-on: https://go-review.googlesource.com/37302
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-21 18:41:56 +00:00
Josh Bleecher Snyder
84a855e547 cmd/vet/all: add mips and mipsle
Change-Id: I689b2e8e214561350f88fa4e20c8f34cf69dc6a7
Reviewed-on: https://go-review.googlesource.com/37301
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-21 18:41:47 +00:00
Josh Bleecher Snyder
8ccd007f24 cmd/vet/all: work around vet printf checker deficiencies
cmd/vet has a known deficiency in its handling of fmt.Formatters.
This causes a spurious printf error only for non-host platforms.
Since cmd/vet/all may get run on any given platform,
whitelists cannot help here.

Work around the issue by skipping printf tests entirely
for non-host platforms.

Work around the one known acceptable false positive from vet
by whitelisting the file that contains it.

Change-Id: Id74b3d4db0519cf9a670a065683715f856266e45
Reviewed-on: https://go-review.googlesource.com/36936
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-21 18:41:38 +00:00
Rob Pike
d698e614a2 cmd/vet: include function name or value in copylock message
Given
	var t struct{ lock sync.Mutex }
	var fntab []func(t)
	f(a(), b(&t), c(), fntab[0](t))

Before:
	function call copies lock value: struct{lock sync.Mutex} contains sync.Mutex

After:
	call of fntab[0] copies lock value: struct{lock sync.Mutex} contains sync.Mutex

This will make diagnosis easier when there are multiple function calls per line.

Change-Id: I9881713c5671b847b84a0df0115f57e7cba17d72
Reviewed-on: https://go-review.googlesource.com/34730
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-01-03 19:23:23 +00:00
Aliaksandr Valialkin
d160982a2e cmd/vet: fix copylocks false positive on len(array) and cap(array).
This is a follow-up for https://golang.org/cl/24340.

Updates #14664.
Fixes #18374.

Change-Id: I2831556a9014d30ec70d5f91943d18c33db5b390
Reviewed-on: https://go-review.googlesource.com/34630
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-12-24 21:41:34 +00:00
Ian Lance Taylor
27fb26c77c cmd/vet: avoid crash in cgo test on recursive type
This CL also re-enables the cgo tests that were accidentally disabled
in CL 32754.

Fixes #18389.

Change-Id: I2fdc4fe3ec1f92b7da3db3fa66f4e0f806fc899f
Reviewed-on: https://go-review.googlesource.com/34660
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-21 04:29:31 +00:00
Tilman Dilo
1657d76d5b cmd/vet: fix panic and handling of XML in struct field tag check
The check for duplicate struct field tags introduced in CL 16704
triggers a panic when an anonymous struct field with a duplicate name
is encountered. For such a field, the names slice of the ast.Field is
nil but accessed regardless to generate the warning message.

Additionally, the check produces false positives for XML tags in some
cases:

- When fields are encoded as XML attributes, a warning is produced when
  an attribute reuses a name previously used for an element.

  Example:
    type Foo struct {
        First int `xml:"a"`
        NoDup int `xml:"a,attr"` // warning about reuse of "a"
    }

- When XMLName is used to set the name of the enclosing struct element,
  it is treated as a regular struct field.

  Example:
    type Bar struct {
        XMLName xml.Name `xml:"a"`
        NoDup   int      `xml:"a"` // warning about reuse of "a"
    }

This commit addresses all three issues. The panic is avoided by using
the type name instead of the field name for anonymous struct fields when
generating the warning message. An additional namespace for checking XML
attribute names separately from element names is introduced. Lastly,
fields named XMLName are excluded from the check for duplicate tags.

Updates #18256

Change-Id: Ida48ea8584b56bd4d12ae3ebd588a66ced2594cc
Reviewed-on: https://go-review.googlesource.com/34070
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-12-13 03:13:24 +00:00
Daniel Martí
68fda1888e all: call flag.Parse from TestMain only if used
These don't use any flags in TestMain itself, so the call is redundant
as M.Run will do it.

Change-Id: I00f2ac7f846dc2c3ad3535eb8177616b2d900149
Reviewed-on: https://go-review.googlesource.com/33275
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-16 19:01:01 +00:00
Josh Bleecher Snyder
f8dc4f20f8 Revert "cmd/vet: ignore printf failures in cmd"
This reverts commit f15915af4e.

CL 32851 fixed cmd/vet's handling of fmt.Formatter.

Updates #17057.

Change-Id: I3409100d16037645946fe7fe78fbb173e1648494
Reviewed-on: https://go-review.googlesource.com/33166
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-13 21:28:13 +00:00
Dhananjay Nakrani
662d253515 cmd/vet: ignore unrecognized verbs for fmt.Formatter
Updates #17057.

Change-Id: I54c838d3a44007d4023754e42971e91bfb5e8612
Reviewed-on: https://go-review.googlesource.com/32851
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-11-13 15:03:26 +00:00
Josh Bleecher Snyder
8f215d8c1f cmd/vet/all: add bitwidths for mips and mipsle
cmd/vet/all still doesn't run for mips/mipsle,
because the rest of the toolchain doesn't yet
fully support it.

Change-Id: I1a86b0edddbdcd5f43e752208508d99da7aabbb3
Reviewed-on: https://go-review.googlesource.com/33134
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-11-11 16:07:32 +00:00
Francesc Campoy
47bdae9422 cmd/vet: detect defer resp.Body.Close() before error check
This check detects the code

	resp, err := http.Get("http://foo.com")
	defer resp.Body.Close()
	if err != nil {
		...
	}

For every call to a function on the net/http package or any method
on http.Client that returns (*http.Response, error), it checks
whether the next line is a defer statement that calls on the response.

Fixes #17780.

Change-Id: I9d70edcbfa2bad205bf7f45281597d074c795977
Reviewed-on: https://go-review.googlesource.com/32911
Reviewed-by: Rob Pike <r@golang.org>
2016-11-10 20:38:11 +00:00
Brad Fitzpatrick
e017802597 cmd/vet: parallelize tests
Was 2.3 seconds. Now 1.4 seconds.

Next win would be not running a child process and refactoring main so
it could be called from tests easily. But that would also require
rewriting the errchk written in Perl. This appears to be the last user
of errchk in the tree.

Updates #17751

Change-Id: Id7c3cec76f438590789b994e756f55b5397be07f
Reviewed-on: https://go-review.googlesource.com/32754
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-11-06 20:11:48 +00:00
Robert Griesemer
26e43779f1 Revert "cmd/vet: teach vet about ast.AliasSpec"
This reverts commit aa8c8e770e.

Reason: Decision to back out current alias implementation.

For #16339.

Change-Id: I4db9a8d6b3625c794be9d2f1ff0e9c047f383d28
Reviewed-on: https://go-review.googlesource.com/32827
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Manghane <cmang@golang.org>
2016-11-05 00:18:05 +00:00
Vladimir Stefanovic
5bfafff03f cmd/vet: add support for GOARCH=mips{,le}
Change-Id: Ie7b40cc67e9901e252a4a48225bbd745a66d2673
Reviewed-on: https://go-review.googlesource.com/31511
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-04 18:26:49 +00:00
Josh Bleecher Snyder
e83911d6fc cmd/vet/all: add s390x support
Some of these whitelist entries could be
eliminated, e.g. by the addition of Go
declarations, but this is a start.

Change-Id: I2fb3234cf05ebc6b161aacac2d4c15d810d50527
Reviewed-on: https://go-review.googlesource.com/32671
Reviewed-by: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-03 15:33:27 +00:00
Josh Bleecher Snyder
aa8c8e770e cmd/vet: teach vet about ast.AliasSpec
Fixes #17755

Change-Id: I1ad1edc382b1312d992963054eb82648cb5112d2
Reviewed-on: https://go-review.googlesource.com/32588
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-11-03 13:32:05 +00:00
Michael Munday
5513f855f6 cmd/vet: add test case for ppc64{,le}
Adapted from the mips64 test case.

Fixes #17745.

Change-Id: I46f0900028adb936dcab2cdc701ea11d0a3cb95e
Reviewed-on: https://go-review.googlesource.com/32611
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Rob Pike <r@golang.org>
2016-11-02 22:40:34 +00:00
Michael Munday
eed2bb71d2 cmd/vet: fix go vet on s390x assembly
Test adapted from the mips64 test.

Fixes #15454.

Change-Id: If890c2d18a4a03a08faaa2e674edd7223af60290
Reviewed-on: https://go-review.googlesource.com/22472
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-02 19:21:16 +00:00
Josh Bleecher Snyder
35d342eb7d cmd/vet/all: update whitelists
Change-Id: Ic66eb2939d83559610e62cbb181a8faa6193ecc4
Reviewed-on: https://go-review.googlesource.com/32426
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-31 19:26:59 +00:00
Russ Cox
e3324a4b66 cmd/vet: diagnose non-space-separated struct tag like json:"x",xml:"y"
This is not strictly illegal but it probably should be (too late)
and doesn't mean what it looks like it means:
the second key-value pair has the key ",xml".

Fixes #14466.

Change-Id: I174bccc23fd28affeb87f57f77c6591634ade641
Reviewed-on: https://go-review.googlesource.com/32031
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
2016-10-26 13:37:51 +00:00
Russ Cox
a850dbdef2 cmd/vet: accept space-separated tag lists for compatibility with cmd/go
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-25 20:42:01 +00:00
Matthew Dempsky
213ee3d20e go/types: match cmd/compile's alignment for complex64
Fixes #17584.

Change-Id: I3af31cc1f2e9c906f3b73e77f3b092624ba78fbe
Reviewed-on: https://go-review.googlesource.com/31939
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-10-25 16:33:01 +00:00
Josh Bleecher Snyder
eb6ae3ca7b cmd/vet/all: remove cmd/compile/internal/big special case
It no longer exists as of CL 31010.

Change-Id: Idd61f392544cad8b3f3f8d984dc5c953b473e2e5
Reviewed-on: https://go-review.googlesource.com/31934
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-25 14:59:27 +00:00
Josh Bleecher Snyder
5db7c6d32c cmd/vet/all: update whitelists
Change-Id: Ie505b5d8cdfe4ffda71f909d6f81603b6d752eed
Reviewed-on: https://go-review.googlesource.com/31937
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-25 14:50:18 +00:00
Alan Donovan
07a22dbd34 cmd/vet: cgo: emit no error for calls to C.CBytes
Fixes issue golang/go#17563

Change-Id: Ibb41ea9419907193526cc601f6afd07d8689b1fe
Reviewed-on: https://go-review.googlesource.com/31810
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-24 19:05:50 +00:00
David Symonds
5a0d50f4eb cmd/vet: fix formatting of headings in doc.go.
This will cause godoc to correctly render these docs,
since go/doc.ToHTML requires no punctuation for headings.

Change-Id: Ic95245147d3585f2ccc59d4424fcab17d2a5617b
Reviewed-on: https://go-review.googlesource.com/31319
Reviewed-by: Rob Pike <r@golang.org>
2016-10-18 00:06:20 +00:00
Alex Browne
4940a83790 cmd/vet: check for duplicate json, xml struct field tags
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-10-13 02:08:58 +00:00
Aliaksandr Valialkin
ee8ec42929 cmd/vet: skip printf check for non-constant format string during failed import
Fixes #17006

Change-Id: I3c2060ca5384a4b9782a7d804305d2cf4388dd5a
Reviewed-on: https://go-review.googlesource.com/29014
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-10-05 14:25:46 +00:00
Tormod Erevik Lea
b625810d28 cmd/vet: hard-code program name in usage message
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-09-19 20:26:36 +00:00
Rob Pike
892d146a7a cmd/vet: fix documentation for -structtags
Was missing a title in the documentation, so it formatted wrong.

Fixes #17124

Change-Id: Ie8a9c36fbc54eed7d8a761f89a088e582b8c062d
Reviewed-on: https://go-review.googlesource.com/29340
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-09-19 02:02:44 +00:00
Josh Bleecher Snyder
1c5ac0827d cmd/vet/all: check platforms concurrently
Change-Id: I63e7fd7f62aa80e1252b0c5b6c472439aa66da73
Reviewed-on: https://go-review.googlesource.com/29169
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-14 21:54:17 +00:00
Josh Bleecher Snyder
d72c2846f1 cmd/vet/all: update whitelist
CL 29110 brought the fix into the main tree.

Change-Id: I7bf02670d40f22d35c63e05173419fdee9f93462
Reviewed-on: https://go-review.googlesource.com/29161
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-14 18:37:55 +00:00
Josh Bleecher Snyder
f15915af4e cmd/vet: ignore printf failures in cmd
This is a temporary measure to work around #17057.
It will be reverted when #17057 is fixed.

Change-Id: I21c02f63f3530774c91065cfed5d9c566839ed9f
Reviewed-on: https://go-review.googlesource.com/28959
Reviewed-by: Rob Pike <r@golang.org>
2016-09-10 22:42:26 +00:00