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

5 Commits

Author SHA1 Message Date
Alan Donovan
4764d6fd6e cmd/vet/internal/cfg: don't crash on malformed goto statement
Change-Id: Ib285c02e240f02e9d5511bd448163ec1d4e75516
Reviewed-on: https://go-review.googlesource.com/24323
Reviewed-by: Rob Pike <r@golang.org>
2016-06-22 17:09:26 +00:00
Alan Donovan
b65cb7f198 cmd/vet: -lostcancel: check for discarded result of context.WithCancel
The cfg subpackage builds a control flow graph of ast.Nodes.
The lostcancel module checks this graph to find paths, from a call to
WithCancel to a return statement, on which the cancel variable is
not used.  (A trivial case is simply assigning the cancel result to
the blank identifier.)

In a sample of 50,000 source files, the new check found 2068 blank
assignments and 118 return-before-cancel errors.  I manually inspected
20 of the latter and didn't find a single false positive among them.

Change-Id: I84cd49445f9f8d04908b04881eb1496a96611205
Reviewed-on: https://go-review.googlesource.com/24150
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-06-21 14:58:33 +00:00
Aliaksandr Valialkin
22db3c5a62 cmd/vet: improve checking unkeyed fields in composite literals
- Simplified the code.

- Removed types for slice aliases from composite literals' whitelist, since they
are properly handled by vet.

Fixes #15408
Updates #9171
Updates #11041

Change-Id: Ia1806c9eb3f327c09d2e28da4ffdb233b5a159b0
Reviewed-on: https://go-review.googlesource.com/22318
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2016-04-28 13:51:40 +00:00
David Symonds
e6a8daceb0 cmd/vet: refresh command for updating whitelist data.
This excludes internal and testdata packages, as well as func types.

No new whitelist entries were found.

Change-Id: Ie7d42ce0a235394e4bcabf09e155726a35cd2d3d
Reviewed-on: https://go-review.googlesource.com/21822
Reviewed-by: Rob Pike <r@golang.org>
2016-04-11 00:39:53 +00:00
Russ Cox
5b1a8a5239 cmd/vet: move cmd/vet/whitelist to cmd/vet/internal/whitelist
This was a mistake made when bringing cmd/vet into the main repo.

Fixes #13416.

Change-Id: I03b512ab944577c56085aea06df8ff5e1acc16d7
Reviewed-on: https://go-review.googlesource.com/17455
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2015-12-05 06:26:17 +00:00