1
0
mirror of https://github.com/golang/go synced 2024-09-30 22:48:32 -06:00
Commit Graph

1278 Commits

Author SHA1 Message Date
Josh Bleecher Snyder
cc1e254c18 go.tools/astutil: delete all matching imports in DeleteImport
Fixes golang/go#8459.

LGTM=crawshaw, bradfitz
R=bradfitz, crawshaw
CC=golang-codereviews
https://golang.org/cl/128220043
2014-08-14 11:51:51 -07:00
Alan Donovan
f13ba78920 go.tools/go/loader: make error message for massive failure (e.g. no "fmt") more concise.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/126080043
2014-08-14 12:10:34 -04:00
Andrew Gerrand
c98886f21f go.tools/dashboard/builder: use https to talk to dashboard
LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/125100043
2014-08-13 10:54:52 +10:00
Andrew Gerrand
2607e9b47a go.tools/dashboard/app: add go.sys to builder package list
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/129030043
2014-08-13 07:55:36 +10:00
Andrew Gerrand
573fa9f0bd cmd/cover: show file coverage in HTML drop down
As requested on Stack Overflow: http://goo.gl/ams9fY
(Kudos to sberry for his JavaScript solution, provided there.
This change does the same thing on the server side.)

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/127030043
2014-08-12 09:22:11 +10:00
Alan Donovan
cd6b8ab06d go.tools/go/ssa: improvements to CreateTestMainPackage.
(1) support Example functions defined in programs that don't
    import "testing".  We emit code to testmain.main() to call
    them directly, since we can't call testing.Main.

(2) expose a FindTests function which reports the set of
    Test, Example and Benchmark functions it finds.
    Certain clients need this.

Added test for logic in FindTests.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/115290048
2014-08-08 14:47:16 -04:00
Robert Griesemer
8ce35843de go.tools/go/types: handle all receiver errors in go/types
Pending parser change in CL 123010044.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/125830043
2014-08-07 12:45:28 -07:00
Alan Donovan
3bbc63016b go.tools/go/loader: report parser errors too.
Previously these were recorded in the PackageInfo, but not
reported to the user's error handler (types.Config.Error),
which is typically what prints them.

Minor subtlety: that function must now be able to handle error
values that are not of type types.Error.

+ Test (and renamed it).

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/121290043
2014-08-07 12:50:15 -04:00
Alan Donovan
d3f2df4854 go.tools/go/ssa/interp: some fixes to tests
- Break out parts of coverage.go into more specific files.
- Re-enable test of nil interface-to-interface conversion.
- Update initorder test to reflect spec ambiguity and gc vs go/types variance.
- Re-enable test dependent on now-fixed bug 8189 ("value,ok" yields an untyped bool)

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/119530043
2014-08-07 10:57:00 -04:00
Francesc Campoy
11569f39ea go.tools/cmd/present: track page views for every slide.
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/124720043
2014-08-05 16:02:39 -07:00
Robert Griesemer
b31dcd1655 go/types: comma-ok expressions return untyped boolean as 2nd result
Per acceptance of https://golang.org/cl/112320045/ .

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/113990043
2014-08-05 11:34:36 -07:00
Francesc Campoy
82b913fb17 playground: add ctrl-enter shortcut for gofmt (as in the tour)
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/120420044
2014-08-04 15:55:39 -07:00
Francesc Campoy
cf8082eec5 go.tools/playground: return a better message for code starting with a shebang on non local mode
LGTM=adg, dan.kortschak
R=adg, dan.kortschak, campoy
CC=golang-codereviews
https://golang.org/cl/119160043
2014-08-01 15:04:49 -07:00
Alan Donovan
149e030318 go.tools/cmd/ssadump: print packages and functions to stdout, not stderr.
And serialize the printing of each item with a mutex.
It is the formatted output of this tool, after all.

Also: minor doc tweaks.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/114620044
2014-08-01 14:44:37 -04:00
Alan Donovan
4228ee8063 go.tools/go/ssa: improve printing of anonymous functions.
Examples:
- "foo$1" becomes "pkg.foo$1"
- "init$1" (meaning the first declared "init" function) becomes "init#1",
   to distinguish it from "init$1" (meaning the first anonymous function
   within the synthetic "init" function that initializes package-level vars).

It is now an invariant that all source-level (non-synthetic)
functions have distinct names, and that all names include the
enclosing package.  Added test for this.

+ updated various clients.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/122750043
2014-07-31 17:37:41 -04:00
Alan Donovan
b419465131 go.tools/go/ssa: print types package-relative in all instructions.
It was missing from the four conversions and the Make* instructions.

(Experiments with pure bytes.Buffer-based printing were not faster; various TODOs removed.)

LGTM=crawshaw
R=gri, crawshaw
CC=golang-codereviews
https://golang.org/cl/58040043
2014-07-31 16:29:47 -04:00
Alan Donovan
31c2077fe3 go.tools/go/ssa: rename promote.go and split into two files, {methods,wrappers}.go.
Also:
- move shared utilities to util.go.
- rename types.Selection vars.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/113550043
2014-07-31 16:28:34 -04:00
Josh Bleecher Snyder
3442faf3c1 go.tools/imports: go/format outbound code
Fixes golang/go#8035.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews, shurcool
https://golang.org/cl/120840044
2014-07-28 17:15:17 -07:00
Andrew Gerrand
8aabc9a084 go.tools/godoc: drop scheme from links
golang.org now serves HTTPS,
so the scripts should work
with either HTTP ot HTTPS.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/111640043
2014-07-25 10:27:31 +10:00
Alan Donovan
935700a081 go.tools/go/loader: apply DisplayPath to working directory of cgo tool.
This transforms the virtualized directory (build.Context).Dir to a physical one,
for proprietary build systems that distinguish them.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/116230043
2014-07-24 14:12:52 -04:00
Alan Donovan
9ffbf29971 go.tools/go/ssa: add hook to testmain.go for proprietary (non-'go test') build systems.
Users need only add an extra file to the package to specify
additional imports and initialization steps in testmain, to
match their build system.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/120090043
2014-07-23 15:37:37 -04:00
Chris Manghane
129869a1a6 go.tools/dashboard: don't do method calls or field lookups on a possibly nil repo
LGTM=mischief, adg
R=adg, mischief
CC=golang-codereviews
https://golang.org/cl/106660043
2014-07-23 10:22:29 -07:00
Alan Donovan
b5528ca070 go.tools/go/pointer: add test file missing from CL 112610043 (rev 32ae05502022)
TBR=gri
R=gri
CC=adg, golang-codereviews
https://golang.org/cl/111580043
2014-07-23 12:28:56 -04:00
Andrew Gerrand
63db0771ef go.tools/godoc: fix search heading anchors
Right now they're all "Global" so you can't click use the table of
contents headings for "Types", "Functions", and "Methods".

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/118100043
2014-07-23 09:59:58 +10:00
Alan Donovan
e5d15a9781 go.tools/go/pointer: add intrinsic for time.startTimer, which is implemented in C.
Without it, no value appears to be sent on NewTicker/NewTimer channels.

+ test

Also:
- add (callgraph.Edge).{Description,Pos} convenience methods
  to simplify client code when Site==nil.

LGTM=gri
R=gri, friestein68503
CC=golang-codereviews
https://golang.org/cl/112610043
2014-07-22 18:30:06 -04:00
Alan Donovan
f9612295cb go.tools/oracle: pointsto: if the queried expression is an lvalue, use the type of its value, not its address.
(Probable regression caused by recent changes to VarValue.)

+ regression test.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/116160044
2014-07-22 18:29:56 -04:00
David Symonds
105b764ad0 benchcmp: Fix invocation instructions.
`go test` takes -run and -bench; the -test.run and -test.bench flags
are only for the test binary itself.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/113390043
2014-07-22 17:50:39 +10:00
Keith Randall
562b65fda7 vet: LEA* opcodes don't need to have matching length source and destination.
LGTM=rsc
R=golang-codereviews, khr, rsc
CC=golang-codereviews
https://golang.org/cl/117950044
2014-07-21 21:15:39 -07:00
Alan Donovan
cd61993a08 go.tools/go/types: move {Type,Object}Of methods from *loader.PackageInfo to *types.Info
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/113750044
2014-07-17 15:10:29 -04:00
Alan Donovan
514bdfb1b7 go.tools/go/ssa: improve generated code for addressable expressions.
If an expression is addressable, we compute its address then load, rather than
extracting the value of subelements.  For aggregates this avoids large copies.
Example:
        var x [2]struct{y [3]int}
        print(x[1].y[2])

Was:
t0 = local [3]struct{x [5]int} (x)                 *[3]struct{x [5]int}
t1 = *t0                                            [3]struct{x [5]int}
t2 = t1[1:int]                                         struct{x [5]int}
t3 = t2.x [#0]                                                   [5]int
t4 = t3[2:int]                                                      int

Now:
t1 = &t0[1:int]                                       *struct{x [5]int}
t2 = &t1.x [#0]                                                 *[5]int
t3 = &t2[2:int]                                                    *int
t4 = *t3                                                            int

Also:
- make emitFieldSelections responsible for calling emitDebugRef, as
  one of its two calls was forgetting to do it.
- relax the specification of (*Program).VarValue because not all
  subexpressions are materalized as values now.
- fix up the objlookup.go test expectations to match.

go/ssa/interp test runs 10% faster.

Thanks to Peter Collingbourne for pointing this out.

LGTM=pcc
R=pcc, gri
CC=golang-codereviews
https://golang.org/cl/109710043
2014-07-17 15:06:09 -04:00
Robert Daniel Kortschak
09286920ba go.tools/cmd/present: move jquery ui code into static
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/118760043
2014-07-16 16:33:46 +10:00
Andrew Gerrand
cc0b856ebe go.tools/godoc/static: remove unnecessary mainframe wrapper
Fixes golang/go#8300.

LGTM=adonovan
R=golang-codereviews, adonovan, bradfitz
CC=golang-codereviews
https://golang.org/cl/113130044
2014-07-16 09:39:11 +10:00
Alan Donovan
b2ea2e8560 go.tools/go/ssa: permit "for range x"
+ test

Also: don't generate init() functions for packages loaded from export data.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/111200043
2014-07-15 17:34:50 +01:00
Robert Griesemer
e078800d1f go/types: permit "for range x"
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/110630044
2014-07-15 08:54:09 -07:00
Francesc Campoy
bbb1c45ba5 go.tools/present: add support for figure captions
LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/110600043
2014-07-15 08:23:16 -07:00
Alan Donovan
f2db24a319 go.tools/go/loader: use new types.TypeAndValue mode predicates.
PackageInfo:
- deleted IsType
- inlined + deleted: ValueOf, TypeCaseVar, ImportSpecPkg
- on failure, TypeOf accessor now returns nil (was: panic)

go/ssa: avoid extra map lookups by using Uses or Defs directly when safe to do so,
and keeping the TypeAndValue around in expr0().

LGTM=gri
R=gri, pcc
CC=golang-codereviews
https://golang.org/cl/107650043
2014-07-11 10:50:09 +01:00
Robert Griesemer
961ab3ca8d go.tools/go/types: provide TypeAndValue predicates
LGTM=adonovan
R=adonovan, pcc
CC=golang-codereviews
https://golang.org/cl/110880043
2014-07-10 16:59:50 -07:00
Alan Donovan
a16d58355f go.tools: various doc fixes.
LGTM=crawshaw
R=gri, crawshaw
CC=golang-codereviews
https://golang.org/cl/91420044
2014-07-10 07:24:52 -04:00
Alan Donovan
400db89b86 go/types: fix incorrect InitOrder in packages created from multiple calls to (*Checker).Files.
The InitOrder needs to be reset.

+ Test.

This bug manifested itself in duplicate HTML in the godoc -analysis view,
e.g. "f((x)" or "funcfunc f()"

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/107660044
2014-07-10 06:30:01 -04:00
Peter Collingbourne
661e836afb go.tools/go/ssa: introduce a sanity check for dead referrers
This extends the sanity checker to identify and report referrers
which do not appear in the function's instruction lists, and fixes two
bugs in the lifting algorithm which were caught by the sanity check.

LGTM=adonovan
R=adonovan
CC=axwalk, golang-codereviews
https://golang.org/cl/110210045
2014-07-10 06:27:25 -04:00
Shenghou Ma
daba707591 go.tools/playground/socket: fix nacl/arm command line.
nacl_helper_bootstrap_arm doesn't consult $PATH for sel_ldr_arm.

LGTM=adg
R=adg, dan.kortschak
CC=golang-codereviews
https://golang.org/cl/112010044
2014-07-10 00:46:43 -04:00
Peter Collingbourne
4329a10ae7 go.tools/go: separate interface construction from method set construction
We introduce a method (*Interface).Complete(), which is intended
to be called from clients after all embedded interfaces have been
fully defined. For importers, this will definitely be the case
after the import has finished, so each importer have been updated
to do so, with the exception of the gcimporter, which does not use
embedded interfaces, therefore Complete() can be called immediately
after construction.

Building the method set separately from the constructor type caused
some problems with go/importer, which copies the types.Interface
object, leading to there existing two almost-identical interface
types referenced from interface method receivers, only one of which
has been completed. To avoid this situation, the importer has been
modified to construct the interface object only once.

Fixes golang/go#8177.

LGTM=gri
R=gri, dave, gordon.klaus, adonovan
CC=golang-codereviews
https://golang.org/cl/105060044
2014-07-09 20:00:49 -07:00
David Crawshaw
54655402b5 go.tools/dashboard/builder: android cross compiles
LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/112870045
2014-07-09 15:44:17 -04:00
Alan Donovan
99d45c0e8e godoc/analysis: show analysis status in UI (source file view)
Also:
- declare PackageInfo, FileInfo types to simplify API.
- update docs:
        eliminate this TODO item
        document improved analysis times
        state that -analysis=pointer implies -analysis=type

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/112770044
2014-07-09 07:59:55 -04:00
Francesc Campoy
bb2f616e98 go.toosl/cmd/present: Remove border from iframes
If the author wants a border they can add it on their own.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/107590045
2014-07-09 13:14:06 +10:00
Robert Daniel Kortschak
ea9b1bd08b go.tools/playground/socket: add support for Native Client on arm
LGTM=minux
R=adg, minux
CC=golang-codereviews
https://golang.org/cl/110900043
2014-07-08 22:40:37 -04:00
Shenghou Ma
5a340a31b7 godoc/static/analysis/help.html: fix a typo
LGTM=crawshaw, r
R=golang-codereviews, crawshaw, jscrockett01, r
CC=golang-codereviews
https://golang.org/cl/110120044
2014-07-08 22:40:11 -04:00
Robert Daniel Kortschak
063db5971c go.tools/playground/socket: log connections and code snippet run requests
This logs all successful handshakes and all requests to run code snippets;
it is not immediately obvious how to limit this to non-localhost hosts, or
to instances where publicly available playgrounds are allowed without resorting
to addition of a new global. The level of noise on the log should not be too
great.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/112850043
2014-07-09 12:14:27 +10:00
Robert Griesemer
32c9809768 go.tools/go/types: const decls with invalid init expr must not panic
Make sure const objects always have a valid (possibly unknown) value.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/106530044
2014-07-08 13:33:43 -07:00
Alan Donovan
79e0c7b71e go.tools/go/pointer: eliminate TODOs regarding sound treatment of unsafe.Pointer.
Ain't gonna happen.

Also, don't emit a warning when this happens.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/110030044
2014-07-08 10:11:36 -04:00