1
0
mirror of https://github.com/golang/go synced 2024-10-01 03:18:33 -06:00
Commit Graph

609 Commits

Author SHA1 Message Date
Rob Pike
bae6bf6180 go.tools/cmd/vet: improve error message for build tag problems
Fixes golang/go#6979.

R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/37720048
2013-12-18 16:06:56 -08:00
Robert Griesemer
00fab17bd2 go.tools/ssa/interp: fix build (add missing runtime function)
Introduced by CL 41860043.

R=adonovan
TBR=adonovan
CC=golang-dev
https://golang.org/cl/42950044
2013-12-18 11:49:45 -08:00
Robert Griesemer
4e3127283a go.tools/go/gcimporter: adjust for new .a file format
R=rsc, r
CC=golang-dev
https://golang.org/cl/41510044
2013-12-18 10:53:59 -08:00
Brad Fitzpatrick
b6e674b8e7 go.tools/imports: fix fileset mismatch bug
Fixes golang/go#6884

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/43890043
2013-12-18 09:09:37 -08:00
David Crawshaw
64c6d0410b go.tools/imports: fix test broken in b33d2e25015b6793aac4f9dcef3d8a8d1c9243b3
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/41950048
2013-12-18 03:44:50 -08:00
David Crawshaw
c87866116c go.tools/imports: move goimports from github to go.tools.
From revision d0880223588919729793727c9d65f202a73cda77.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/35850048
2013-12-17 21:21:03 -05:00
Robert Griesemer
53dfbf8a00 go.tools: fix build
Missed a couple of places with previous CL.

R=adonovan
TBR=adonovan
CC=golang-dev
https://golang.org/cl/40850046
2013-12-17 16:21:23 -08:00
Robert Griesemer
74d33a9c33 go.tools/go/types: use types.ChanDir instead of ast.ChanDir
Clearer code and fewer dependencies on go/ast.

R=adonovan
CC=golang-dev
https://golang.org/cl/43630043
2013-12-17 15:45:01 -08:00
Andrew Gerrand
1de4f6df60 go.tools/godoc/static: add 'fmtImportEl' option to playground
The 'fmtImportEl' option lets the called specify a checkbox element
that determines whether to send the 'imports=true' key/value pair when
calling '/fmt'.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/43240043
2013-12-18 09:32:51 +11:00
Dmitriy Vyukov
676ac131e1 dashboard/app: properly limit commit description length
Ensure that we do not split UTF-8 rune in half.
Otherwise appengine python scripts will break badly.

R=adg, r
CC=golang-dev
https://golang.org/cl/42530043
2013-12-17 12:14:27 +04:00
Chris Manghane
9e3292f107 go.tools/dashboard: Turn off multilib compilation in gccgo.
R=adg
CC=golang-dev
https://golang.org/cl/43020043
2013-12-16 14:50:22 -08:00
Chris Manghane
2cbda9de61 go.tools/dashboard: Fix incorrect parsing of log hash.
R=adg
CC=golang-dev
https://golang.org/cl/43000043
2013-12-16 14:50:09 -08:00
Robert Griesemer
a02c76070b go/importer: fix build (disable tests that won't run on builders)
R=adonovan
TBR=adonovan
CC=golang-dev
https://golang.org/cl/43010043
2013-12-16 14:44:22 -08:00
Brad Fitzpatrick
ae534bcb6c astutil: fix a comment corruption case
This fixes a case where adding an import when there are is no
existing import declaration can corrupt the position of
comments attached to types. This was the last known
goimports/astutil corruption case.

See golang.org/issue/6884 for more details.

Unfortunately this requires changing the API to add a
*token.FileSet, which we should've had before.  I will update
goimports (the only user of this API?) immediately after
submitting this.

This CL also contains a hack (used only in this case of no
imports): rather than fix the comment positions by hand
(something that only Robert might know how to do), it instead
just prints the AST, manipulates the source, and re-parses
the AST. We can fix up later.

Fixes golang/go#6884

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/38270043
2013-12-16 14:43:29 -08:00
Robert Griesemer
5eb4fdc120 go.tools/go/importer: simplified exporter/importer
By using a simple (graph-based) serialization algorithm
and binary encoding, a significantly more compact export
data format is achieved than what the current compilers
use. Furthermore, the exporter and importer are completely
symmetric algorithms that are compact, and much easier to
change/expand.

R=adonovan
CC=golang-dev
https://golang.org/cl/42960043
2013-12-16 14:28:17 -08:00
Robert Griesemer
91abc02562 go.tools/go/types: print interface methods in sorted order
Required for testing code of clients.

R=adonovan
CC=golang-dev
https://golang.org/cl/35940049
2013-12-16 13:53:08 -08:00
Brad Fitzpatrick
59db975409 godoc: limit concurrency to local disk filesystem
Not for Go 1.2.  Still needs a flag.

Linux at least (and likely other OSes) don't like you doing
a few hundred readdirs at once and spawing as many threads.

R=golang-dev, adg, jeremyjackins
CC=golang-dev
https://golang.org/cl/30620043
2013-12-16 11:25:50 -08:00
Robin Eklind
01caf7ba7e ssa: Update the location of the ssadump command in an example comment.
R=golang-dev, adonovan
CC=golang-dev
https://golang.org/cl/42420043
2013-12-16 10:05:40 -05:00
Alan Donovan
8b9d1fd507 go.tools/oracle: implements: now shows whole-program implements relation for selected type.
(Previously it showed the implements relation for all types within the query package.)

R=crawshaw
CC=golang-dev
https://golang.org/cl/42000043
2013-12-13 18:00:55 -05:00
Alan Donovan
f119874203 go.tools/oracle: improvements to command set and performance.
Command set:
- what: an extremely fast query that parses a single
  file and returns the AST stack, package name and the
  set of query modes that apply to the current selection.
  Intended for GUI tools that need to grey out UI elements.
- definition: shows the definition of an identifier.
- pointsto: the PTA features of 'describe' have been split
  out into their own command.
- describe: with PTA stripped out, the cost is now bounded by
  type checking.

Performance:
- The importer.Config.TypeCheckFuncBodies predicate supports
  setting the 'IgnoreFuncBodies' typechecker flag on a
  per-package basis.  This means we can load dependencies from
  source more quickly if we only need exported types.
  (We avoid gcimport data because it may be absent or stale.)
  This also means we can run type-based queries on packages
  that aren't part of the pointer analysis scope. (Yay.)
- Modes that require only type analysis of the query package
  run a "what" query first, and restrict their analysis scope
  to just that package and its dependencies (sans func
  bodies), making them much faster.
- We call newOracle not oracle.New in Query, so that the
  'needs' bitset isn't ignored (oops!).  This makes the
  non-PTA queries faster.

Also:
- removed vestigial timers junk.
- pos.go: existing position utilties split out into own file.
  Added parsePosFlag utility.
- numerous cosmetic tweaks.

+ very basic tests.

To do in follow-ups:
- sophisticated editor integration of "what".
- better tests.
- refactoring of control flow as described in comment.
- changes to "implements", "describe" commands.
- update design doc + user manual.

R=crawshaw, dominik.honnef
CC=golang-dev, gri
https://golang.org/cl/40630043
2013-12-13 10:04:55 -05:00
Robert Griesemer
3df3227c35 go.tools/go/exact: fix bug introduced with CL 41170043
R=adonovan
CC=golang-dev
https://golang.org/cl/37820052
2013-12-12 14:18:40 -08:00
Robert Griesemer
e2828468ff go.tools/go/exact: serialization support and better unknown handling
- fixed various imprecise doc strings
- consistent handling of unknown values

R=adonovan
CC=golang-dev
https://golang.org/cl/41170043
2013-12-12 13:43:00 -08:00
Robert Griesemer
4728c2f3f6 go.tools/go/types: turn off internal debug mode
- much improved performance
- enable when testing changes

R=adonovan
CC=golang-dev
https://golang.org/cl/36480049
2013-12-12 13:32:36 -08:00
Robert Griesemer
693727787e go.tools/go/types/typemap: fix formatting verb
(%p is trouble if the interface value is not a pointer)

R=adonovan
CC=golang-dev
https://golang.org/cl/41440043
2013-12-12 12:12:32 -08:00
Alan Donovan
036b7d3489 go.tools/types: skip "imported but not used" check if IgnoreFuncBodies.
Obviously in that mode, we can't correctly diagnose such
errors, so we shouldn't attempt it (and emit false positives).

R=gri
CC=golang-dev
https://golang.org/cl/41080043
2013-12-11 21:12:08 -05:00
Robert Griesemer
11cfd4a636 go.toools/go/types: clearer comment (per adonovan)
R=adonovan
CC=golang-dev
https://golang.org/cl/40860045
2013-12-11 10:48:17 -08:00
Joel Sing
130693e419 go.tools/dashboard/builder: do not fatal on subrepo fetch errors
When fetching repos it is not uncommon for a 500 or 503 to be returned
from code.google.com. When this happens, log the error and continue so
that we try again later, rather than treating this as fatal.

R=adg, dvyukov
CC=golang-dev
https://golang.org/cl/38720044
2013-12-11 23:47:31 +11:00
Alan Donovan
26d5173f5e go.tools/oracle: "callees": skip pointer analysis at static call sites.
This improves both performance (most calls are static) and
precision (e.g. for static calls in dead code).

Also, break callees() function into smaller ones.

R=crawshaw
CC=golang-dev
https://golang.org/cl/38740045
2013-12-10 10:16:35 -05:00
Alan Donovan
5d70784aca go.tools/pointer: replace Config.Print (callback) with a Result.PrintCalls (map).
This avoids leaking nodeids into client code before the
analysis has had a chance to run the (forthcoming) constraint
optimizer, which renumbers them.

R=crawshaw
CC=golang-dev
https://golang.org/cl/39410043
2013-12-10 09:15:39 -05:00
Andrew Gerrand
05f8c7dc66 go.tools/dashboard/app: app index.yaml
This is equivalent to the previously-reviewed change to Dmitry's
performance dashboard repo clone:
https://golang.org/cl/35490043

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/39840043
2013-12-10 16:43:15 +11:00
Andrew Gerrand
922f326cd7 go.tools/dashboard/app: fix tests and add TODO to reall fix them
This change is a really nasty hack to preserve the magic header
across requests. The nasty hack will go away once we refactor these
tests to use the new "appengine/aetest" package instead.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/39230043
2013-12-10 15:30:35 +11:00
Josh Bleecher Snyder
866b24e166 cmd/vet: check for sync types being copied during function calls
Using a type containing a sync type directly
in a function call (whether as a receiver,
a param, or a return value) is an easy way
to accidentally copy a lock or other sync primitive.
Check for it.

The test as implemented does not provide 100%
coverage; see the discussion near the bottom of
testdata/copylock.go for shortcomings.

Fixes golang/go#6729.

R=adg, r, dsymonds
CC=golang-dev
https://golang.org/cl/23420043
2013-12-09 20:14:28 -08:00
Robert Griesemer
d6902b2ad5 go/tools/go/gcimporter: avoid possible endless loops in case of errors
R=adonovan
CC=golang-dev
https://golang.org/cl/39630045
2013-12-09 15:43:31 -08:00
Peter Collingbourne
7dcd8ded7c go.tools/go/types: handle embedded interfaces in NewInterface
R=gri
CC=golang-dev
https://golang.org/cl/39040043
2013-12-09 13:37:24 -08:00
Alan Donovan
fb3d862cae go.tools/importer: move PathEnclosingInterval to package astutil.
R=crawshaw
CC=golang-dev
https://golang.org/cl/38650044
2013-12-09 09:36:29 -05:00
Andrew Gerrand
55fb2e8e28 go.tools/dashboard/app: only accept commits when given master key
R=dvyukov, rsc
CC=golang-dev
https://golang.org/cl/37790044
2013-12-09 14:33:08 +11:00
Alan Donovan
6b75c15eec go.tools/pointer: replace Pointer, PointsToSet interfaces with their sole implementations.
(Elminate premature abstraction.)

The test probes used Pointer!=nil for the "is pointerlike"
predicate. Now that Pointer is a struct, they check the type
of the expression, which is more accurate.  Two probes on
non-pointerlike values have beem removed.

R=crawshaw
CC=golang-dev
https://golang.org/cl/38420043
2013-12-06 12:52:04 -05:00
Brad Fitzpatrick
2d324f247c astutil: in test, dump AST before and after on failure
R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/37740043
2013-12-06 10:11:13 +04:00
Alan Donovan
7f8168b1d4 go.tools/pointer: allow clients to request both pts(v) and pts(*v) in the same analysis.
Also: add (ptset).String().

R=crawshaw
CC=golang-dev
https://golang.org/cl/36800044
2013-12-05 22:30:42 -05:00
Alan Donovan
100638985b go.tools/ssa/interp: fix bug: recovered panic without NRPs should return zero values.
+ test.

R=gri
CC=golang-dev
https://golang.org/cl/38040043
2013-12-05 21:22:57 -05:00
Alan Donovan
d063887ea0 go.tools/ssa: move AllFunctions to ssautil subpackage
R=gri
CC=golang-dev
https://golang.org/cl/37970043
2013-12-05 17:16:00 -05:00
Alan Donovan
d6490fa510 go.tools/ssa/ssautil: Switches() utility infers multiway branches.
(Note new subpackage ssa/ssautil.)

R=gri, axwalk, gri
CC=golang-dev
https://golang.org/cl/36710043
2013-12-05 17:00:17 -05:00
Alan Donovan
b5016cbbbd go.tools/ssa: expose dominator tree of control-flow graph in API.
New APIs:
  (*BasicBlock).{Idom,Dominees,Dominates}
  (*Function).DomPreorder

Messy but systematic refactoring of domNode:
- renamed "domInfo".
- embedded directly in BasicBlock, not as pointer. Block field removed.
- Level field removed; was unused.
- Working state of LT algorithm now in its own type.
  {semi,parent,ancestor} fields moved into it.
- remaining fields made private; accessors added.
- use 32-bit ints for pre/postorder numbers.
- allocate LT working space (5 copies of fn.Blocks) contiguously.

dom.go is simpler but somewhat more verbose.

Also:
- we always build the domtree now---yet memory usage is down 5%.
- number the Recover block too.
- add sanity check for DomPreorder.

R=gri
CC=golang-dev
https://golang.org/cl/37230043
2013-12-05 09:50:18 -05:00
Alan Donovan
c846ececde go.tools/ssa: eliminate remaining uses of operands of "untyped" type.
Added sanity check.

R=gri
CC=golang-dev
https://golang.org/cl/37270043
2013-12-04 13:59:55 -05:00
Brad Garcia
ff7cfafc58 godoc: Add URLForSrcQuery option to godoc.Presentation.
This allows the creation of URLs to lines of source code with a query
term highlighted without assuming godoc source code URL parameters.
Needed for interfacing with other source code viewing servers.

R=bradfitz
CC=golang-dev
https://golang.org/cl/34200043
2013-12-04 10:37:01 -05:00
Andrew Wilkins
df34f98521 go.tools/cover: split parsing code out from cmd/cover
Split the profile parsing code out of cmd/cover into
a reusable package, to support third-party coverage
tools.

R=golang-dev, r, adg
CC=golang-dev
https://golang.org/cl/36050045
2013-12-03 20:55:21 -08:00
Robert Griesemer
ff84d756df go.tools/go/types: avoid spurious error in a common case
R=adonovan
CC=golang-dev
https://golang.org/cl/36900043
2013-12-03 17:51:54 -08:00
Shenghou Ma
5d386107a0 go.tools/cmd/oracle: output help messages to stderr for consistency
Fixes golang/go#6838.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/36820043
2013-12-03 17:37:59 -05:00
Robert Griesemer
14cf5b0a28 go.tools/go/types: fun with Hilbert: a const arithmetic test
This test generates a program that declares the constant
elements of an n*n Hilbert matrix, its inverse, and the
constant elements of the explicit product of the two.
The product should be the identity matrix; that check is
also expressed as a constant expression. Type-checking
verifies that the product is indeed the identity matrix
by asserting the result of the identity check (using the
assert built-in which is available for type-check tests).

The test is run for n = 5. Other values can be tested via
the -H flag, say: go test -run=Hilbert -H=100

The generated program can be written to a file for testing
the constant arithmetic of a compiler: go test -out=test.go

Because of the mathematically precise constant arithmetic
of go/types, this test should always succeed and is only
limited by the size of the matrix. It does run successfully
from n = 0 to values larger than 100.

The Hilbert matrix is famous for being ill-conditioned and
thus exposes arithmetic imprecision very quickly. The gc
compiler only produces a correct result for n = 0 (trivially),
and n = 1 at the moment.

R=adonovan, rsc
CC=golang-dev
https://golang.org/cl/35840043
2013-12-03 13:36:57 -08:00
Robert Griesemer
62a3fc7538 go.tools/go/types: clean up internal iota in all cases
R=dsymonds
CC=golang-dev
https://golang.org/cl/33570043
2013-11-26 17:48:47 -08:00