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

1473 Commits

Author SHA1 Message Date
Alan Donovan
aba8625c37 go.tools/go/buildutil: more utilities.
- ParseFile (core of go/loader's parseFiles(); also used by refactor/rename)
- ContainingPackage (core of Oracle's guessImportPath; also used by refactor/rename)
- Accessors for effective "methods" of build.Context:
  FileExists, OpenFile, IsAbsPath, JoinPath.

LGTM=sameer
R=dave, sameer
CC=golang-codereviews, gri
https://golang.org/cl/146120043
2014-09-23 10:20:48 -04:00
Alan Donovan
c90cb9e042 refactor/satisfy: enumerate interface satisfaction constraints induced by Go syntax.
The type checker does not currently report the set of pairs of
types that are tested for assignability (though gri and I
agree that it should).  This information is useful for many
applications.  For example, refactoring tool needs to know the
minimal set of interface satisfaction constraints that must be
preserved during a refactoring.

This package is a stopgap measure to deduce the same
information using another pass.  Unlike go/types, it is not
robust against inputs containing type errors.

LGTM=sameer
R=gri, sameer
CC=golang-codereviews
https://golang.org/cl/136470043
2014-09-22 16:19:29 -04:00
Alan Donovan
897f6677ae refactor/lexical: understand the structure of the lexical environment.
The Uses, Defs and Scope information provided by go/types is
inadequate for answering "what if?" queries about the
structure of the lexical environment.

In this code, for example,

        var x int

        func f() {
                print(x)
                x := ""
                print(x)
        }

the two referring Idents x appear at the same lexical depth,
inside the function f's Scope object, yet they resolve to
different objects.

This package associates a lexical.Environment instance with
every reference to capture these differences.  Each
environment is a linked list of enclosing Blocks, and for each
block, a number indicating what prefix of its bindings are
visible.  (Zero for the first 'x' reference above, 1 for the
second.)

+ Smoke test over stdlib.

This functionality could be integrated with the type checker
in lieu of the not-so-useful types.Info.Scopes data, at little
extra cost in code or in running time/space.  We should talk
about that.

LGTM=sameer
R=gri, sameer
CC=golang-codereviews
https://golang.org/cl/143790043
2014-09-19 13:11:01 -04:00
Alan Donovan
fec4d1f60d refactor/importgraph: add test of cycles
Nodes in a strongly connected component (which includes most
stdlib packages) appear in results of both "forward" and
"reverse" searches from any other node in the same SCC.

LGTM=sameer
R=sameer
CC=golang-codereviews, gri
https://golang.org/cl/136470044
2014-09-18 10:05:26 -04:00
Andrew Gerrand
520acf2e17 go.tools/dashboard/app: don't ignore field mismatch errors
This was a hold-over from when we removed install counts years ago.
All the Package entities are well-formed these days.

LGTM=dsymonds
R=dsymonds
CC=golang-codereviews
https://golang.org/cl/138620043
2014-09-18 18:07:02 +10:00
Alan Donovan
15e89a9a8c godoc/analysis: log one error per error package.
Previously type errors were reported via the web interface but
not logged, but this led to confusion as to why SSA
construction and/or pointer analysis were not attempted.

LGTM=gri
R=gri, bradfitz
CC=golang-codereviews
https://golang.org/cl/136660043
2014-09-16 16:24:52 -04:00
Robert Griesemer
9dcf670d50 go.tools/go/types: documentation follow-up
Added documentation per request in
https://golang.org/cl/108230044 .

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/137620044
2014-09-15 11:32:39 -07:00
Alan Donovan
f13b4c029c go.tools/go/ssa: fix a race condition in needMethodsOf.
Now all calls are serialized with a mutex.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/140600043
2014-09-15 14:01:54 -04:00
Alan Donovan
b94e29089b godoc: run bake.sh again.
CL 141540043 was half-baked.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/142130043
2014-09-15 13:13:07 -04:00
Alan Donovan
ebc87c5c5e godoc: fix bug in "internal call graph" tree widget.
Today I learned that getElementByClass returns an
HTMLContainer, not an array, so the for loop was iterating its
properties, which include:
- the methods of the type, which were filtered out by the condition;
- the array-like integer indices of the elements, which we want;
- the ids of the same elements (!), which we weren't expecting.
The net result is that various functions were called twice,
causing the tree to be double-populated and clicks to cause
and expand+collapse.

It's a miracle to me that any JS program even approximately works.

Fixes golang/go#8237

LGTM=bradfitz
R=gri, bradfitz
CC=golang-codereviews
https://golang.org/cl/141540043
2014-09-15 13:00:40 -04:00
Alan Donovan
1bd4ccf210 go/loader: clarify the nocgo check.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/144910043
2014-09-15 12:03:05 -04:00
Robert Griesemer
ab25303a78 go.tools/go/loader: disable test case to fix build
TBR=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/139650043
2014-09-12 20:29:27 -07:00
Robert Griesemer
f04d2c5c34 go.tools/go/importer: fix importer test for 32bit platforms
(The previous fix attempt didn't address all uses uses of
types.Config.Check.)

Fixes golang/go#8366.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/141430044
2014-09-12 08:17:14 -07:00
Andrew Gerrand
37340ffc2f go.tools/dashboard: use shorter notification template for cl updates
LGTM=dvyukov
R=dvyukov
CC=golang-codereviews
https://golang.org/cl/139320043
2014-09-12 11:14:03 +10:00
Robert Griesemer
83560bf6db go.tools/go/importer: fix test (src/pkg -> src)
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/142010043
2014-09-11 15:22:30 -07:00
Alan Donovan
85a9565822 go/ssa: fix bug causing (manual) go/pointer stdlib test to crash.
The needMethods cache logic was wrong: it would treat any
previous call as a cache hit, even if 'skip' was true for that
call.  As a result it could fail to generate methods for some
'skip' types, i.e. anonymous structs.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/144750043
2014-09-11 18:08:33 -04:00
Alan Donovan
66176e290c go/buildutil: rename AllPackages{,List} -> {ForEachPackage,AllPackages}.
This CL is the first refactoring automated by "gorename". :)
Though I had to update the comments and run 'hg gofmt'.   :(

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/142930043
2014-09-11 14:33:37 -04:00
Alan Donovan
78aabae27e go.tools: eliminate three copies of the allPackages utility.
The one in godoc/analysis will have to wait.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/142860043
2014-09-11 14:14:53 -04:00
Alan Donovan
7de4da029c go/ssa/interp: exclude "runtime" from the list of initial packages in the test
It now has a main() function, which was confusing the logic to find the entry point.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/142860044
2014-09-11 13:31:05 -04:00
Alan Donovan
6c93dbff3e go.tools/godoc: deal with fallout from $GOROOT/src/pkg -> $GOROOT/src renaming.
To avoid breaking URLs, we redirect /src/pkg/* to /src/*.

The URL /pkg is now the "directory" /src, which triggers the
"Packages" index.

All other references to "src/pkg" are now gone,
except a number in the namespace documentation which are
probably still illustrative.

Tested: go test cmd/godoc godoc
        Manual inspection of src and src/pkg pages.
        with GOROOT and GOPATH packages
        -analysis
        /AUTHORS file URL still works

LGTM=bradfitz, adg
R=bradfitz, adg
CC=golang-codereviews
https://golang.org/cl/141770044
2014-09-10 09:02:54 -04:00
Alan Donovan
3cded4a933 refactor/importgraph: a utility for computing the import graph.
Refactoring tools can use this to determine an upper bound on
the set of packages potentially affected by a refactoring.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/141310043
2014-09-09 18:39:26 -04:00
Alan Donovan
77b9ff6df3 go.tools/go/buildutil: AllPackages: enumerate all packages in a Go workspace.
This function has been copied at least 6 times throughout
go.tools.  This implementation is superior since it does
all I/O through the virtualized go/build file system, and it
is highly parallel (and much faster).

We expose two flavours, simple (for existing tests) and
parallel (for high-performance tools such as gorename).

This CL creates the go/buildutil package, which is intended for
utilities related to go/build.

+ test.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/137430043
2014-09-09 18:39:14 -04:00
Rob Pike
e548cb3dfe go.tools/cmd/stringer: fix docs: stringer is not a "go tool"
Documentation change only. The binary will not be installed
using the "go tool" mechanism.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/133710046
2014-09-09 13:29:38 -07:00
Chris Manghane
84c740c8b6 dashboard/env: install dejagnu for gccgo's testsuite
LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/141860043
2014-09-09 10:56:30 -07:00
Chris Manghane
bbfe5adf96 coordinator: add support for different build dashboards
LGTM=bradfitz
R=bradfitz
CC=adg, golang-codereviews
https://golang.org/cl/135520043
2014-09-09 10:54:11 -07:00
Johan Euphrosine
afc3bf64c0 dashboard: optimize linux docker image size
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/132590043
2014-09-08 15:35:40 -07:00
Alan Donovan
159879b336 go.tools/imports: src/pkg -> src
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/141260043
2014-09-08 14:20:12 -04:00
Robert Griesemer
476d41c67b go.tools/go/types: better error messages
- for unused packages where base(package path) != package name
- for conflicts between imported packages or dot-imported objects
  and local declarations

Per suggestions from adonovan, inspired by the gc error messages.

LGTM=adonovan
R=adonovan, bradfitz
CC=golang-codereviews
https://golang.org/cl/135550043
2014-09-08 10:29:00 -07:00
Alan Donovan
9872f0d268 go.tools/*: replace $GOROOT/src/pkg with $GOROOT/src where appropriate.
(godoc is excluded from this CL since it will continue to use
/src/pkg in its URL namespace, making the necessary cleanup
more subtle.)

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/141770043
2014-09-08 13:24:38 -04:00
Andrew Gerrand
850afc6bb5 go.tools/dashboard/app: update CL threads with perf notifications
LGTM=dvyukov
R=dvyukov
CC=golang-codereviews, rsc
https://golang.org/cl/135460043
2014-09-08 15:46:41 +10:00
Alex Brainman
d39af6c903 go.tools/cmd/stringer: add .exe suffix to executable name in TestEndToEnd
Fixes windows build

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/140360043
2014-09-08 13:55:05 +10:00
Andrew Gerrand
96adaa5618 go.tools/godoc: remove Google+ buttons
LGTM=bradfitz
R=golang-codereviews, bradfitz, dsymonds
CC=golang-codereviews
https://golang.org/cl/138180043
2014-09-08 10:05:20 +10:00
Rob Pike
d03e8a67df go.tools/cmd/stringer: delete needless subtraction of zero in generated code
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/136270043
2014-09-05 17:05:28 -07:00
Rob Pike
d0448f16e3 go.tools/cmd/stringer: add end-to-end test that compiles, runs, and verifies the generated method
In the process, fix a bug in one of the method generators.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/141130043
2014-09-05 15:42:23 -07:00
Brad Fitzpatrick
d30a33e346 dashboard/builder: finish the previous -report=false change
We weren't using the *report flag enough.

LGTM=proppy
R=proppy
CC=golang-codereviews
https://golang.org/cl/132650043
2014-09-05 14:48:12 -07:00
Brad Fitzpatrick
cb318644df dashboard/builder: add -report=false flag for testing Docker images
LGTM=proppy
R=proppy
CC=golang-codereviews
https://golang.org/cl/138140043
2014-09-05 13:00:51 -07:00
Russ Cox
27a49c973b goimports: print \n at end of errors
LGTM=r
R=r
CC=bradfitz, golang-codereviews
https://golang.org/cl/136230045
2014-09-05 14:13:44 -04:00
Chris Manghane
f0c7ec0ef3 dashboard/env: add gccgo amd64 builder
LGTM=bradfitz
R=bradfitz
CC=adg, golang-codereviews
https://golang.org/cl/139250043
2014-09-05 11:08:15 -07:00
Brad Fitzpatrick
89759c3d1a dashboard/coordinator: set USER for the -nocgo builder
... since it already caught a problem and was fixed in
hg rev 0b99c2137ccc.

I pushed this live already just so don't get a whole column of
fail that might hide other issues. Real users have USER set
anyway. (Perhaps we should set it for all our builders?)

LGTM=adg
R=golang-codereviews
CC=adg, dave, golang-codereviews, minux
https://golang.org/cl/137180043
2014-09-04 17:48:56 -07:00
Brad Fitzpatrick
8c30c1b367 dashboard/env: add a cgo-disabled Linux builder
I think this is all that's needed?

Fixes golang/go#4795

LGTM=adg, dave
R=adg, dave
CC=golang-codereviews
https://golang.org/cl/138090043
2014-09-04 16:58:49 -07:00
Rob Pike
75b67f833e go.tools/cmd/stringer: fix generated map code
Missed comment from previous code review.
Next up: execution tests so this won't happen again

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/134480043
2014-09-04 16:18:38 -07:00
Rob Pike
22ede605a7 go.tools/cmd/stringer: use const for names, slice for map strings
Improve the generated code by using a const instead of a var for the names string.
This requires some refactoring to get neat const() and var() blocks.
Also change the generate map code go use a single sliced string, to reduce the
size of the compiled representation (only one string value).

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/135450044
2014-09-04 16:06:51 -07:00
Brad Fitzpatrick
a4e9bdfb20 dashboard/builder: set correct path to gcc
Otherwise when running -386 and -amd64 on the same machine
with both copies of TDM-GCC installed (the installer wizard lets
you choose which one, and you can do both options in two
different install attemps), one previously got this error when
using the 64-bit gcc with a 386 build:

--- FAIL: TestStdcallAndCDeclCallbacks (0.12s)
panic: Failed to load C:\Users\WINDOW~1\AppData\Local\Temp\1\TestCDeclCallback960696761\test.dll: %1 is not a valid Win32 application. [recovered]
       panic: Failed to load C:\Users\WINDOW~1\AppData\Local\Temp\1\TestCDeclCallback960696761\test.dll: %1 is not a valid Win32 application.

goroutine 81490 [running]:
runtime.panic(0x5b8c00, 0x1390d4e0)
        c:/gobuilder/windows-386-gce-b24422c8828f/go/src/pkg/runtime/panic.c:130 +0xed fp=0x12d99f78 sp=0x12d99f24
testing.func·006()
        c:/go/src/pkg/testing/testing.go:421 +0x147 fp=0x12d99fd0 sp=0x12d99f78
----- stack segment boundary -----
runtime.panic(0x5b8c00, 0x1390d4e0)
        c:/gobuilder/windows-386-gce-b24422c8828f/go/src/pkg/runtime/panic.c:98 +0x17a fp=0x12155e98 sp=0x12155e44
syscall.MustLoadDLL(0x1390b7c0, 0x4a, 0x2)
        c:/go/src/pkg/syscall/dll_windows.go:62 +0x6c fp=0x12155eb8 sp=0x12155e98
runtime_test.(*cbTest).run(0x12155f24, 0x1213cc00, 0x1390b7c0, 0x4a)
        c:/gobuilder/windows-386-gce-b24422c8828f/go/src/pkg/runtime/syscall_windows_test.go:399 +0x36 fp=0x12155ef4 sp=0x12155eb8
runtime_test.TestStdcallAndCDeclCallbacks(0x1213cc00)
        c:/gobuilder/windows-386-gce-b24422c8828f/go/src/pkg/runtime/syscall_windows_test.go:448 +0x28e fp=0x12155fac sp=0x12155ef4

TBR=cmang
R=cmang
CC=adg, golang-codereviews
https://golang.org/cl/141070043
2014-09-04 14:52:34 -07:00
Rob Pike
9207f67279 go.tools/cmd/stringer: add tests
Refactor a little to make testing easier.
Add golden tests and a check fo splitIntoRuns, which is the subtlest piece.
Still to come: execution tests.

Also fix a few issues in the generated code.

LGTM=gri
R=gri
CC=golang-codereviews, josharian
https://golang.org/cl/134450044
2014-09-04 14:16:59 -07:00
Brad Fitzpatrick
196bd6741e dashboard/builder: fallback to finding build keys from GCE metadata
LGTM=cmang
R=cmang
CC=adg, golang-codereviews
https://golang.org/cl/133610043
2014-09-04 13:46:24 -07:00
Yasuhiro Matsumoto
0673c34537 go.tools/cmd/stringer: Fix build on 32bit OSs.
LGTM=r
R=golang-codereviews, gri, r
CC=golang-codereviews
https://golang.org/cl/138040043
2014-09-04 10:51:38 -07:00
Robert Griesemer
de5d818681 go.tools/go/types: simplify LookupFieldOrMethod
Remove a 2nd lookup in some cases.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/136190043
2014-09-04 10:13:49 -07:00
Brad Fitzpatrick
710872e5c8 dashboard/coordinator: support reusing VM disk between boots
Creating a new disk is the major latency cost of creating a
new instance.  If we reuse a previous disk image, the VM and
CoreOS boot much quicker and start building again.

So add a mode where we don't mark the disk as delete-on-death
when we create it, and we search for a suitably-named existing
one on creation and try to reuse it.

It's a cache, essentially. It's still stateless.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/135410043
2014-09-04 07:10:07 -07:00
Brad Fitzpatrick
1481828125 dashboard/env: restore the periods after docker build
They're required but adg wanted them removed and I listened :)

TBR=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/136200043
2014-09-04 07:09:54 -07:00
Brad Fitzpatrick
c0bc9ba88d dashboard: add Cloud Storage upload support to create.go
Then make the coordinator and linux environment Makefiles have
an upload target. Amusingly, this actually worked: the Docker
images now tar + compress + upload over HTTP all in a stream,
without even knowing how large the resulting tar.gz will be until
it's done uploading.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/140200043
2014-09-03 21:41:16 -07:00