1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:04:44 -07:00
Commit Graph

829 Commits

Author SHA1 Message Date
Alan Donovan
7ef831a4e6 go.tools/go/ssa: perform nil check when taking value of interface method.
+ test.

Fixes golang/go#7269

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/84650046
2014-04-09 18:00:57 -04:00
Alan Donovan
b12fe1707c go.tools/go/loader: slashify the name of packages found by walking the file tree.
Otherwise on Windows the enumerated package "net\\http" will
be distinct from the imported package "net/http" leading to
strange errors.  (A similar bug was fixed in go/ssa/stdlib_test.go.)

Fixes golang/go#7189

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/86170043
2014-04-09 15:47:42 -04:00
Alan Donovan
7f24a8300e go.tools/godoc: restore line anchors to the source view.
These were removed when adding the -analysis flag (CL
60540044), ostensibly for performance, but I can't reproduce
the serious slowdowns I saw then.  In any case, they are
needed for certain URLs.

Fixes golang/go#7743

LGTM=bgarcia
R=bgarcia
CC=golang-codereviews
https://golang.org/cl/86150043
2014-04-09 15:41:18 -04:00
Brad Fitzpatrick
87f95283ac imports: limit local disk concurrency, avoid reads in non-Go directories
If $GOPATH was large, or $GOPATH was $HOME and $HOME/src had
many files, the unbounded concurrency in loadPkgIndex/loadPkg
could make the operating system unhappy with so many
threads. (sigh once again for no async file IO and needing
threads for file operations)

In addition, don't call go/build.Context.Import on directories
that we've already determined to have no go files in them.
It's just a waste of time. Makes it about 3x faster on my
machine with hot caches and a big $HOME/src.

Fixes golang/go#7731

LGTM=iant, adg
R=golang-codereviews, iant, adg
CC=david.crawshaw, golang-codereviews
https://golang.org/cl/85670044
2014-04-08 16:43:52 -07:00
Robert Griesemer
fa0f6bd591 go.tools/cmd/godex: update documentation
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/83580046
2014-04-07 13:49:05 -07:00
Robert Griesemer
42a4cd3392 go.tools/godoc: sanitize function signatures for object index
Fixes golang/go#7703.

LGTM=bgarcia
R=bgarcia
CC=golang-codereviews
https://golang.org/cl/84410045
2014-04-07 12:54:28 -07:00
Brad Fitzpatrick
93a9176852 dashboard/builder: pass GO386 to child builder, like GOARM
Update golang/go#7720

LGTM=dave
R=adg, dave
CC=golang-codereviews, rsc
https://golang.org/cl/84410046
2014-04-06 17:15:49 -07:00
Alex Brainman
2961704231 go.tools/cmd/godoc: correct TestCLI match string on windows
Fixes golang/go#7707

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/84280045
2014-04-06 12:41:24 +10:00
Robert Griesemer
55ea531257 go.tools/godoc: ignore //line comments in source code
Per suggestion from Gary Burd.

Fixes golang/go#5247.

LGTM=rsc
R=bgarcia, rsc
CC=golang-codereviews
https://golang.org/cl/84050044
2014-04-03 13:12:54 -07:00
Alan Donovan
bf97d00464 go.tools/.hgignore: ignore *.got files from "golden file" testing.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/83680043
2014-04-02 16:42:42 -04:00
Robert Griesemer
0b23073b5c go.tools/go/types: type-check interfaces in reverse dependency order
Side-effect: Because interfaces are now type-checked in reverse order,
cycle errors in interface declarations appear at the "end" rather than
at the "beginning" of the cycle in the source code. This is harmless.
Eventually we may want to do dependency order determination and thus
cycle detection for all types before fully type-checking them, which
might simplify some code and also produce consistently positioned cycle
errors again.

Fixes golang/go#7158.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/83640043
2014-04-02 11:42:29 -07:00
Alan Donovan
14aef25050 go.tools/refactor/eg: remove debugging code accidentally committed.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/83650043
2014-04-02 12:39:10 -04:00
Alan Donovan
bfcffc697d go.tools/refactor/eg: an example-based refactoring tool.
See refactor/eg/eg.go for details.

LGTM=crawshaw
R=crawshaw, gri, kamil.kisiel, josharian
CC=golang-codereviews
https://golang.org/cl/81010043
2014-04-02 12:24:55 -04:00
Robert Griesemer
d7048bec64 go.tools/go/types: simplified init dependency data structures
Preparation for fixing issue 7158.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/83160045
2014-04-02 09:01:28 -07:00
Robert Griesemer
fb8f3e8fbf go/tools/cmd/godex: print combined method sets
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/82890044
2014-04-02 08:49:21 -07:00
Robert Griesemer
3d9dcf408f go.tools/go/types: comment fixes - no code changes
TBR=adonovan

TBR=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/80430045
2014-03-31 16:48:42 -07:00
Robert Griesemer
4f89dd6aed go.tools/go/importer: record low-level encoding format
This avoids confusion when trying to read correctly
encoded export data that happens to be encoded in
a different format (debug vs product).

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/82090043
2014-03-31 09:49:52 -07:00
Andrew Gerrand
58edf2a69d go.tools/dashboard: option to show only "first-class" ports
LGTM=rsc
R=rsc, minux.ma, iant, oleku.konko
CC=golang-codereviews
https://golang.org/cl/81730043
2014-03-31 08:54:14 +11:00
Robert Griesemer
4775a5ed46 go.tools/cmd/godex: remove spurious println
TBR=adonovan

TBR=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/82040043
2014-03-28 15:26:40 -07:00
Robert Griesemer
723686bb4b go.tools/cmd/godex: permit absolute paths for gccgo-generated package (export) files
TBR=adonovan

TBR=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/82030043
2014-03-28 15:17:20 -07:00
Robert Griesemer
7e60d06cfc go.tools/cmd/godex: don't generate prefixes for local and absolute path arguments
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/81340047
2014-03-28 14:59:25 -07:00
Robert Griesemer
1faba6e3b8 go.tools/cmd/godex: replicate path logic for gccgo-new importer
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/81990043
2014-03-28 14:50:14 -07:00
Robert Griesemer
250eb11b9b go.tools/go/gccgoimporter: backported some changes from godex implementation
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/82000043
2014-03-28 14:24:35 -07:00
Robert Griesemer
700390eaed go.tools/cmd/godex: fix prefix generation, filtering, formatting
Details:
- auto-generate prefixes for std lib (e.g., "godex big" works now)
- apply filtering to package-level objects only
- nicer formatting of single-entry const, var, or type declaration

TBR=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/81360046
2014-03-28 12:21:51 -07:00
Robert Griesemer
069e8474de go.tools/go/types: print meaningful panic for unknown expressions
LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/81310045
2014-03-27 15:47:04 -07:00
Alan Donovan
f35b5691f3 go.tools/godoc: fix two regressions caused by -analysis CL.
- Add missing methodset.html template file.
- Suppress initial display of package callgraph.
  Client-side JS will make it visible if there is data.

LGTM=bgarcia
R=crawshaw, bgarcia
CC=golang-codereviews
https://golang.org/cl/81550043
2014-03-27 15:30:14 -04:00
Robert Griesemer
f293460f67 go/tools/cmd/godex: don't print unexported methods
and print exported methods of unexported types

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/80920046
2014-03-27 10:49:59 -07:00
Robert Griesemer
33f2a1701b go.tools/go/types: minor internal cleanup
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/80960046
2014-03-27 10:03:51 -07:00
Alan Donovan
2414677bb9 go.tools/go/loader: add Config.ParserMode configuration parameter.
Existing tools use the default value of zero; their behaviour is unchanged.
(*Config).ParseFile is used only from tests.

LGTM=crawshaw, rsc, gri
R=crawshaw, gri, rsc
CC=golang-codereviews
https://golang.org/cl/79290044
2014-03-27 12:50:26 -04:00
Robert Griesemer
8b161c33a9 go.tools/cmd/godex: support for common path prefixes
All of these work now as expected:

        godex code.google.com/p/go.tools/go/types
        godex go.tools/go/types
        godex go/types
        godex types

Also improved logging/verbose mode.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/80930043
2014-03-26 14:47:52 -07:00
Robert Griesemer
03478d3d3e go.tools/cmd/godex: better argument handling
1) Split a path.name argument at the last '.' that
   is not part of the path.

2) Try various importers always in the same order
   for consistent results (use lists instead of maps).

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/80790043
2014-03-26 09:54:20 -07:00
Robert Griesemer
8648e1a481 go.tools/cmd/godex: nicer formatting
- handle indentation
- write non-empty tuples and signatures in multiple lines
- don't crash for package unsafe

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/79920044
2014-03-26 08:38:40 -07:00
Robert Griesemer
4a27ee3a1b go.tools/cmd/godex: a tool to dump export information
Initial implementation. Lots of missing pieces.

Example use:
        godex math
        godex math.Sin
        godex math.Sin math.Cos

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/76890044
2014-03-25 15:26:38 -07:00
Sameer Ajmani
a1c1cf19ba imports: extend findImports to return a boolean, rename, that tells
goimports to use the package name as a local qualifier in an import.
For example, if findImports("pkg", "X") returns ("foo/bar",
rename=true), then goimports adds the import line:
  import pkg "foo/bar"
to satisfy uses of pkg.X in the file.

This change doesn't add any implementations of rename=true, though one
is sketched in a TODO.

LGTM=crawshaw
R=crawshaw, rsc
CC=bradfitz, golang-codereviews
https://golang.org/cl/76400050
2014-03-25 09:37:10 -04:00
Robert Griesemer
a781b00b0d go.tools/go/types: avoid spurious "declared but not used" errors in case of other errors
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/76810044
2014-03-20 11:28:26 -07:00
Alan Donovan
a4491f08bf go.tools/oracle: fix bug in reduceScope on ad-hoc main packages.
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/77450048
2014-03-19 14:00:35 -04:00
Robert Griesemer
6256e2d81b go.tools/go/types: use package-local type names in errors referring to operands
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/77670043
2014-03-19 09:36:06 -07:00
Robert Griesemer
62216e60bb go.tools/go/types: use unqualified names for local objects in error messages
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/77590043
2014-03-18 13:37:09 -07:00
Andrew Gerrand
5893c271ff go.tools/dashboard: include builder in "invalid key" error message
LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/77250043
2014-03-18 16:02:54 +11:00
Robert Daniel Kortschak
84fae1b215 go.tools/playground: provide script-safe option for playground
This change allows code to be sent safely to a partially sandboxed playground using the Native Client environment.

Execution of non-Go code is blocked when the RunScripts is false to prevent inclusion of code that might escape by virtue of being under a different runtime environment.

Two options for communicating whether to prevent non-Go code were considered: as has been done here and alternatively, using a message field. The latter was not chosen to close that as an attack option.

Another will be follow that adds a -nacl flag to the present command to allow sandboxing of playground code in presentations.

See discussion here: https://groups.google.com/d/topic/golang-dev/Hy-7PBP-T4Q/

LGTM=adg
R=adg, dave
CC=golang-codereviews
https://golang.org/cl/74740045
2014-03-17 16:57:36 +11:00
Alan Donovan
7877131709 cmd/godoc: fix careless crash introduced by recent analysis CL
+ basic integration test

LGTM=bgarcia
R=bgarcia, bradfitz
CC=golang-codereviews
https://golang.org/cl/76410045
2014-03-16 16:17:13 -04:00
Alan Donovan
80c4f06c0f go.tools/godoc: server mode: add support for type and pointer analysis.
See analysis.go for overview of new features.
See README for known bugs and issues.

Much UI polish, testing and optimization work remains, but
this is a starting point.

Flag: we add a new flag -analysis=type,pointer, default "",
for adventurous users only at this stage.
Type analysis takes ~10s for stdlib + go.tools;
Pointer analysis (currently) takes several minutes.

Dependencies: we now include jquery.treeview.js and its GIF
images among the resources.  (bake.go now handles binary.)

LGTM=crawshaw, bgarcia
R=crawshaw, bgarcia
CC=bradfitz, golang-codereviews
https://golang.org/cl/60540044
2014-03-14 18:58:22 -04:00
Alan Donovan
e3dc58c6e0 go.tools/go/loader: use the build.Context's I/O hooks, if any.
Also, add loader.Config.DisplayPath hook, which allows the
filename returned by build.Context.Import() to be transformed
prior to attaching to the AST.  This allows a virtual file
system to be used without leaking into the user interface.

Eliminate parsePackageFiles hook; I don't think we need it any
more.  The test that was using it has been rewritten to use
the build.Context hooks.

LGTM=gri
R=gri, crawshaw
CC=daniel.morsing, golang-codereviews, rsc
https://golang.org/cl/75520046
2014-03-14 16:17:53 -04:00
Robert Griesemer
71b6dfeb19 go.tools/go/types: correct a comment (was pointing at wrong issue)
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/76160044
2014-03-14 10:34:06 -07:00
Brad Garcia
a81074af88 godoc: Output "No match found" only if there is no ast or docs included in info.
Fixes golang/go#7499.

R=minux.ma
CC=golang-codereviews
https://golang.org/cl/75400043
2014-03-14 10:00:10 -04:00
David Symonds
7c69950f7f vet: Don't consider %T for recursive stringers.
Unlike the other anyType verbs, %T never calls String.

Fixes golang/go#7540.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/75580045
2014-03-14 16:08:04 +11:00
Andrew Gerrand
ccd43c1d95 go.tools/dashboard/app: send log hash to gobot on build failure
Fixes golang/go#7322.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/75630043
2014-03-14 09:51:13 +11:00
Robert Griesemer
c4ca0e2489 go.tools/go/types: don't change dot-imported object's parents
With this CL, an Object.Parent() Scope is always the scope in
which the object was originally declared. For dot-imported
objects, that is the package scope of the package from which
the objects are imported (not the file scope into which they
are imported).

Also:

- Changed Scope.Insert to be agnostic regarding blank
identifiers - blank identifiers must be handled outside.

- Fixed handling of blank labels: they are never declared.

Fixes golang/go#7537.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/75570043
2014-03-13 13:22:44 -07:00
David Symonds
d4c8d5dae3 vet: Broaden suppression of recursive stringer warning.
Updates golang/go#6212.

LGTM=r, gri
R=r, gri
CC=golang-codereviews
https://golang.org/cl/75130043
2014-03-13 11:19:34 +11:00
Andrew Gerrand
1a2b7a26cc godoc/static: update site policies link
Fixes golang/go#7520.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/74900047
2014-03-13 10:50:06 +11:00