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

565 Commits

Author SHA1 Message Date
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
Robert Griesemer
3d343e42d1 go.tools/go/types: constants must have constant types
R=adonovan
CC=golang-dev
https://golang.org/cl/33210043
2013-11-26 12:42:52 -08:00
Brad Garcia
f2a9326f67 godoc: fix cmdline_test under Windows. Make sure the absolute path
testcase starts with a volume name for windows platforms.

R=bradfitz
CC=alex.brainman, golang-dev
https://golang.org/cl/32800043
2013-11-26 13:28:43 -05:00
Robert Griesemer
bbf45e5e0c go.tools/go/types: missing assignment checks when assigning to _
R=adonovan, gri
CC=golang-dev
https://golang.org/cl/31340044
2013-11-26 09:34:12 -08:00
Robert Griesemer
b9c2c88573 go.tools/go/types: add Package.SetImports
R=adonovan, neelance
CC=golang-dev
https://golang.org/cl/32500043
2013-11-26 09:19:17 -08:00
Francesc Campoy
6cb29d8d47 go.tools/present: add Raw content to Code for new go-tour.
R=adg
CC=golang-dev
https://golang.org/cl/26390044
2013-11-26 10:04:08 +01:00
Brad Garcia
8880e2e9d7 godoc: Add tests for corpus indexing options.
R=bradfitz
CC=golang-dev
https://golang.org/cl/31370043
2013-11-25 14:23:36 -05:00
Dmitriy Vyukov
23d25a2ed7 dashboard/app: do not send unnecessary data in todo response
R=adg
CC=golang-dev
https://golang.org/cl/30350043
2013-11-25 10:15:56 +04:00
Richard Musiol
397114a391 go.tools/go/gcimporter: ImportData has no need for *bufio.Reader, can get just io.Reader.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/31620043
2013-11-24 12:48:45 -08:00
Robert Griesemer
8c9bb9c1e3 go.tools/go/types: various cleanups
- use unpack also for assignments
- run benchmarks only requested (-b flag)

R=adonovan
CC=golang-dev
https://golang.org/cl/31190044
2013-11-22 20:34:07 -08:00
Brad Garcia
60954257d5 godoc: Update cmdline_test to no longer rely on having GOROOT set
to a valid Go environment.

R=bradfitz
CC=golang-dev
https://golang.org/cl/30960043
2013-11-22 13:58:59 -05:00
Dmitriy Vyukov
1dd13c2478 dashboard/builder: minor fixes and enhancements
- do not print secret key
- log app responses
- allow to customize go repo

R=adg, bradfitz
CC=golang-dev
https://golang.org/cl/29990046
2013-11-22 10:12:51 +04:00
Robert Griesemer
007f41d43e go.tools/go/types: more benchmarks, clearer results
The benchmarks don't permit clear-cut apples-to-apples
comparisons since they depend on the very source code
they are testing. But they do give an indication of
the approximate performance - as a sanity test.

Using 3 different code bases makes it apparent that
there's some difference in performance per code base;
i.e., the lines/s speed varies pretty strongly. This
may be due to setup costs, or other issues. We should
investigate eventually.

R=adonovan
CC=golang-dev
https://golang.org/cl/30650043
2013-11-21 21:08:29 -08:00
Alan Donovan
cf7368c879 go.tools/ssa: fix builder crash in select { case n, _ := <-c: ... }.
Cause: emitExtract requires a type for each component of the
receive tuple; blank supplies no such type.

Solution: remove type parameter for emitExtract as it is no
longer needed: since rev b75cc03b4a56 it is always identical
to the tuple.Type().At(index).

+ tests.

Fixes golang/go#6806.

R=gri, gri
CC=axwalk, golang-dev
https://golang.org/cl/30410043
2013-11-21 15:38:58 -05:00
Alan Donovan
8f1fdf33de go.tools/ssa: opt: improve the "unused φ-node" check to eliminate self-refs, debug-refs.
This removes about 5% of φ-nodes in one large program
and eliminates many zero-value constants.

(This does cause some Idents to no longer map to an ssa.Value.
This is observable in the oracle, whose tests are here updated.)

R=gri, gri
CC=golang-dev
https://golang.org/cl/26980043
2013-11-21 14:19:38 -05:00
Robert Griesemer
ef434a14da go.tools/go/types: record correct type for parenthesized x.(T) in comma-ok expressions
Fixes golang/go#6796.

R=adonovan
CC=golang-dev
https://golang.org/cl/30070044
2013-11-21 09:11:57 -08:00
Brad Garcia
f3faf8b6e0 godoc: add search results that point to documentation instead of source.
Add explicit options to Corpus to control search indexing of documentation, Go source code, and full-text.

R=bradfitz, r
CC=golang-dev
https://golang.org/cl/24190043
2013-11-21 11:55:42 -05:00
Richard Musiol
88e2928490 go.tools/go/types: Do not throw error on division of complex variables by zero.
See http://play.golang.org/p/DrgLKnHaUW
Seems like division of a variable by zero should only throw an error if the variable is an integer.

R=golang-dev, mtj, gri
CC=golang-dev, gri
https://golang.org/cl/29500047
2013-11-20 13:42:30 -08:00
Alan Donovan
2e33158b60 go.tools/oracle: show size and alignment for structs and named types.
Users should be familiar with the sizes of all other types.

Currently we assume amd64 (as do other parts of the oracle,
e.g. go/build tags).  Will parameterize later.

R=crawshaw
CC=golang-dev, gri
https://golang.org/cl/29710043
2013-11-20 16:00:23 -05:00
Brad Garcia
b844907f9f godoc: refactor command-line mode handling.
R=bradfitz
CC=golang-dev
https://golang.org/cl/29230044
2013-11-20 09:56:10 -05:00
Robert Griesemer
b4286c4c1b go.tools/go/types: missing checks for select statements
Also: Use defer to make sure scopes are always closed
even in case of early exits via bailout (and don't cause
an imbalanced scope error in debug mode).

R=adonovan, gri
CC=golang-dev
https://golang.org/cl/29300043
2013-11-19 13:58:01 -08:00
Robert Griesemer
849643aaaf go.tools: cleanups (added copyrights to astutil, clearer logic in go/types)
R=adonovan
CC=golang-dev
https://golang.org/cl/29110043
2013-11-19 09:07:02 -08:00
Robert Griesemer
df6f0829a2 go.tools/go/types: complete expr and type string functions
- consolidate them in (expr|type)string[_test].go
- support for printing all ast.Expr
- fix printing of type: chan (<-chan int) (parentheses)
- more consistent names, comments, and exports

R=adonovan
CC=golang-dev
https://golang.org/cl/28680043
2013-11-18 22:38:48 -08:00
Robert Griesemer
65aa1a4fbe go.tools/go/types: String method for Initializers
Plus a couple of minor fixes.

R=adonovan
CC=golang-dev
https://golang.org/cl/28540043
2013-11-18 11:26:49 -08:00
Brad Fitzpatrick
a284a61701 astutil: add new broken test
Tests will still pass because it's marked as known broken,
but it will log the unexpected for now.

R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/27330043
2013-11-16 14:53:18 -08:00
Robert Griesemer
e785f050b6 go.tools/go/types: add missing checks for short variable declarations
Fixes golang/go#6766.

R=adonovan
CC=golang-dev
https://golang.org/cl/24330044
2013-11-15 14:26:29 -08:00
Robert Griesemer
01f122e48b go.tools/go/gcimporter: fix build by adjusting test to new print output
R=adonovan, bradfitz
CC=golang-dev
https://golang.org/cl/26430049
2013-11-15 11:58:23 -08:00
Marko Mikulicic
ae3dd78063 godoc: Index const and vars in godoc.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/26990043
2013-11-15 11:03:25 -08:00
Alan Donovan
9c112540f6 go.tools/oracle: use SelectionString when printing methods.
R=gri, crawshaw, gri
CC=golang-dev
https://golang.org/cl/26900043
2013-11-15 12:35:11 -05:00
Alan Donovan
45992044b5 go.tools/go/types: SelectionString: print method with selective package-qualification.
R=gri, gri
CC=golang-dev
https://golang.org/cl/26570048
2013-11-15 12:35:03 -05:00
Alan Donovan
f488a2c4f5 go.tools/oracle: use TypeString, ObjectString to print relative (unqualified) names when a package is implied by the context.
+ a couple more tests.

R=gri, crawshaw
CC=golang-dev
https://golang.org/cl/26370046
2013-11-15 09:22:16 -05:00
Alan Donovan
9fcd20e680 go.tools/ssa: display named types package-qualified using types.TypeString.
Details:
- use relative (non-qualified) names in more places
- Member interface now has Package(), RelString() methods.
- (*Function).DumpTo: add "# Package: " header.
- Added sanity checks for String functions.

R=gri, gri
CC=golang-dev
https://golang.org/cl/26380043
2013-11-15 09:21:48 -05:00
Alan Donovan
0820934407 go.tools/go/types: add TypeString, ObjectString utilities
These are variants of Type.String(), Object.String() that
accept a 'from *Package' argument.  If provided, package
qualification is omitted when printing named types belonging
to that package.

This is useful for UIs where a package is implied by context
e.g. ssadump disassembly, oracle output.

+ Test.

R=gri, gri, gordon.klaus
CC=golang-dev
https://golang.org/cl/22190048
2013-11-15 09:20:46 -05:00
Robert Griesemer
91e5190eb9 go.tools/go/types: minor cleanups
R=adonovan
CC=golang-dev
https://golang.org/cl/26430045
2013-11-14 21:38:04 -08:00
Alan Donovan
19dd02b670 go.tools/ssa: fix bug in SSA lifting (!)
The previous code introduced spurious loop-carried
dependencies for variables local to a loop body (for example).
The SSA renaming pass now treats an Alloc instruction like a
Store of the zero value.

Also:
- added regression test
- improved log messages
- made the Store/Load/Alloc cases look more similar.

R=gri, gri
CC=golang-dev
https://golang.org/cl/26750043
2013-11-14 17:33:07 -05:00
Robert Griesemer
27563ff576 go.tools/go/types: move gcimporter to its own package
- fixed a couple of TODOs
- various cleanups along the way
- adjusted clients

Once submitted, clients of go/types that don't explicitly
specify Config.Import will need to add the extra import:

import _ "code.google.com/p/go.tools/go/gcimporter"

to install the default (gc) importer in go/types.

R=adonovan, gri
CC=golang-dev
https://golang.org/cl/26390043
2013-11-14 14:11:43 -08:00
Brad Fitzpatrick
88f792caef godoc: be quiet by default about bad examples
Fixes golang/go#6759

R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/26420044
2013-11-14 09:01:08 -08:00
Alan Donovan
75d66fbb7b go.tools/ssa/interp: fix build breakage.
(intersecting changes in client)

R=gri, gri
CC=golang-dev
https://golang.org/cl/24100046
2013-11-13 18:50:24 -05:00
Robert Griesemer
d1184e294e go.tools/go/types: fix build
(I inadvertently submitted a modified file.)

R=adonovan
CC=golang-dev
https://golang.org/cl/22750044
2013-11-13 15:21:38 -08:00
Richard Musiol
cfc002f30b go.tools/go/types: Do not throw error on division of float variables by zero.
R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/26040043
2013-11-13 15:16:19 -08:00
Alan Donovan
cadc2255fe go.tools/ssa: don't synthesize an empty "testmain" package.
Also, only examine functions defined in *_test.go files.

Added tests for empty and nonempty behaviour of CreateTestMainPackage.
(Required some surgery to interp_test.)

R=gri, gri
CC=golang-dev
https://golang.org/cl/25570044
2013-11-13 16:05:13 -05:00
Alan Donovan
3f686cae84 go.tools/go/types: print named types with package qualification.
Depending on the context, printing only the package name can
be ambiguous or even incorrect since it is valid only within
the environment of a given file's import specs.

(The standard library packages are mostly unique in their last
segment, but this is not the case for proprietary repos.)

R=gri, gri
CC=golang-dev
https://golang.org/cl/26300043
2013-11-13 16:03:41 -05:00
Alan Donovan
677415b351 go.tools/ssa: don't print * on type of package-level vars (*ssa.Global)
R=gri, gri
CC=golang-dev
https://golang.org/cl/26240043
2013-11-13 15:13:55 -05:00
Alan Donovan
70692d3c5f go.tools/pointer: fix constraint generation bug in *ssa.Select.
The previous code assumed that each channel item contained one field.

+ regression test.

R=crawshaw
CC=golang-dev
https://golang.org/cl/25480044
2013-11-13 09:13:42 -05:00
Alan Donovan
775fb1976b go.tools/oracle: make callgraph printing deterministic (and context-insensitive)
+ re-enable test.

R=crawshaw
CC=golang-dev
https://golang.org/cl/25730044
2013-11-13 09:11:10 -05:00