1
0
mirror of https://github.com/golang/go synced 2024-11-06 15:36:24 -07:00
Commit Graph

1071 Commits

Author SHA1 Message Date
Brad Garcia
345b6437fc godoc: Order package results by import count.
Allow searching for packages by directory components.

LGTM=sameer
R=sameer, bradfitz
CC=golang-codereviews
https://golang.org/cl/104220043
2014-06-27 12:47:39 -04:00
Brad Garcia
936715c71c godoc: Strip "/src/pkg/" prefix from identifier keys, so that it's keyed identically to import count.
Intern the documentation strings.

LGTM=sameer
R=sameer, bradfitz
CC=golang-codereviews
https://golang.org/cl/107250043
2014-06-27 10:25:57 -04:00
Peter Collingbourne
969a226d69 go.tools/go/types: correctly type the copy([]byte, string) builtin
LGTM=gri
R=gri, adonovan
CC=golang-codereviews
https://golang.org/cl/104340046
2014-06-26 16:50:12 -07:00
Robert Griesemer
f38fc6a97a go.tools/go/types: add test cases for parenthesized receivers
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/101510043
2014-06-26 09:48:58 -07:00
Aram Hăvărneanu
6cd21e820b go.tools/go/loader: fix Solaris build
Also fix one test that failed on Plan 9.

LGTM=0intro, dave
R=golang-codereviews, 0intro, dave
CC=golang-codereviews
https://golang.org/cl/101370053
2014-06-24 20:47:16 +10:00
Gordon Klaus
3309b0d879 go.tools/go/loader: Add Program.FilePath convenience method for getting the full path of a source file.
LGTM=gri
R=gri, adonovan
CC=golang-codereviews
https://golang.org/cl/107160049
2014-06-23 15:13:07 -07:00
Dmitriy Vyukov
9ba88c9a99 dashboard/app: tag 1.3 release
R=adg
TBR=adg
CC=golang-codereviews
https://golang.org/cl/102590043
2014-06-21 07:48:41 +04:00
Dmitriy Vyukov
b96847cb92 dashboard/builder: fix crash on commits that contain ESC symbol
Currently performance builders crash with:
hg log: unmarshal Mercurial log: XML syntax error on line 4991: illegal character code U+001B

R=adg
CC=golang-codereviews
https://golang.org/cl/110060046
2014-06-21 05:35:07 +04:00
Josh Bleecher Snyder
95a7aeb192 go.tools/cmd/vet: don't panic on commented-out asm
Really two fixes: Don't panic on bad instructions and don't complain about commented out instructions.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/110070044
2014-06-20 16:52:48 -07:00
Josh Bleecher Snyder
9d6cc5fd08 go.tools/cmd/vet: prevent panic on goto without label
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/107260043
2014-06-20 11:08:45 -07:00
Brad Garcia
87e741c38f godoc: add Corpus.ReadIndexFrom, which will be useful for creating a split
indexing/frontend godoc instance.

R=sameer, sameer
CC=golang-codereviews
https://golang.org/cl/78850043
2014-06-20 06:24:12 -04:00
Alan Donovan
5c5c4f4888 go/pointer: fix crash: valueNode(*FreeVar) was allocating 1 node, even for multi-word types.
+ regression test.

Fixes golang/go#8172

Also: return error (not panic) when called with empty input.

LGTM=gri
R=crawshaw, gri
CC=golang-codereviews, jon
https://golang.org/cl/104270043
2014-06-19 15:30:51 -04:00
Alan Donovan
5fe8afcb15 container/intsets: add benchmark of AppendTo method.
Also:
- increase sparsity of sets in benchmarks.
- removed TODO in forEach.  Subword masks had no benefit.
- minor cleanup.

LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/103470049
2014-06-19 14:35:37 -04:00
Alan Donovan
e436e8e4aa go.tools/godoc/analysis: be defensive about files without position info (such as cgo generated files)
Also: improve log message for frontend errors without position info.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/109100043
2014-06-18 18:02:15 -04:00
Alan Donovan
02dba5d1e6 go.tools/go/pointer: fix crash in constraint generation of ssa.Convert to a named unsafe.Pointer type.
+ test.

Fixes golang/go#8231.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/106060046
2014-06-18 18:02:07 -04:00
Alan Donovan
f4ab48cb83 go.tools/go/ssa: remove obsolete comment.
This was a cryptic prediction of the bug you fixed. :)

LGTM=pcc
R=pcc
CC=golang-codereviews
https://golang.org/cl/103470048
2014-06-18 18:00:03 -04:00
Andrew Gerrand
4aa650cf80 go.tools/cmd/godoc: register redirect handler for /dl/
LGTM=minux
R=golang-codereviews, gobot, bradfitz, minux
CC=golang-codereviews
https://golang.org/cl/107050044
2014-06-18 15:44:09 +10:00
Alex Brainman
a20078a082 go.tools/go/loader: skip TestCgoOption on windows
windows std packages do not use cgo.

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/102460043
2014-06-18 11:28:36 +10:00
Mikio Hara
81fd812913 go.tools/cmd/present: update doc
LGTM=adg
R=golang-codereviews, dan.kortschak, gobot, adg
CC=golang-codereviews
https://golang.org/cl/106860043
2014-06-18 11:23:08 +10:00
Robert Griesemer
2bf6947d09 go.tools/cmd/gotype: fix call site (fix build)
TBR=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/101330046
2014-06-17 11:06:19 -07:00
Peter Collingbourne
02990bd494 go.tools/go/gccgoimporter: keep track of package and import priority
Clients such as compilers need this information in order
to correctly link against imported packages.

This also adds support for the condensed import data format
where the priority information is stored as a suffix of the
condensed import data, as well as support for archive files.

LGTM=gri
R=gri
CC=golang-codereviews, iant
https://golang.org/cl/78740043
2014-06-17 10:56:47 -07:00
Alex Brainman
ee07305c2a go.tools/dashboard/builder: skip "path" environment variable on windows
"PATH" and "path" are one and the same environment variable
on windows. We set PATH variable, while "path" is set to its
original value. Windows might use either for the sub-process.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/109980043
2014-06-17 16:59:05 +10:00
Peter Collingbourne
4a6efa0a34 go.tools/go/ssa: add a flag for selecting bare init functions
Bare init functions omit calls to dependent init functions and the
use of an init guard. They are useful in cases where the client uses
a different calling convention for init functions, or cases where
it is easier for a client to analyze bare init functions.

LGTM=adonovan
R=adonovan
CC=golang-codereviews, iant
https://golang.org/cl/78780043
2014-06-16 21:34:51 -04:00
Alan Donovan
f032426134 go.tools/go/pointer: suppress logging by default
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/102490043
2014-06-16 16:31:30 -04:00
Alan Donovan
1582053234 go.tools/oracle: remove stale item
LGTM=crawshaw
R=crawshaw
CC=golang-codereviews
https://golang.org/cl/101320043
2014-06-16 15:46:56 -04:00
Alan Donovan
9b38eafe60 go/pointer: implement pointer equivalence via hash-value numbering, a pre-solver optimization.
This reduces solver time by about 40%.
See hvn.go for detailed description.

Also in this CL:
- Update package docs.
- Added various global opt/debug options for maintainer convenience.
- Added logging of phase timing.
- Added stdlib_test, disabled by default, that runs the analysis
  on all tests in $GOROOT.
- include types when dumping solution

LGTM=crawshaw
R=crawshaw, dannyb
CC=golang-codereviews
https://golang.org/cl/96650048
2014-06-16 15:46:07 -04:00
Alan Donovan
47c0a8f0c3 go.tools/go/types: give Label objects a non-nil Package() too.
New invariant: all user-defined objects have an associated package.
Added a check of this invariant to stdlib_test.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/104170043
2014-06-16 12:31:46 -04:00
Alan Donovan
6db8a00c75 go.tools/go/ssa: write zero value when storing a composite literal in-place if necessary
Previously, statements such as:

type T struct { a, b int }
[...]
x = T{}
x = T{b: 1}

would only affect the aggregate members mentioned in the composite
literal and leave the other members unchanged. This change causes us
to write a zero value to the target in cases where the target is not
already known to hold a zero value and the number of initializers in
the composite literal differs from the number of elements in its type.

Author: Peter Collingbourne.  (hg clpatch got confused)

LGTM=pcc
R=pcc
CC=golang-codereviews
https://golang.org/cl/107980045
2014-06-16 12:29:30 -04:00
Andrew Gerrand
ba844075b3 go.tools/godoc/static: don't capture ctrl-tab in editor
This fixes an issue where Firefox users can't ctrl-tab out to switch
to other tabs when using the playground.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/106020043
2014-06-16 11:36:20 +10:00
Andrew Gerrand
a94a6a54d1 go.tools/go/types/typeutil: use reflect instead of unsafe
Godoc depends on this package.
Packages that use unsafe cannot be deployed to App Engine.
Packages that use reflect can.
This package needn't use unsafe, so don't.

LGTM=adonovan, rsc
R=rsc, adonovan
CC=golang-codereviews
https://golang.org/cl/105960043
2014-06-14 12:45:55 +10:00
Josh Bleecher Snyder
d46b792624 cmd/vet: check for use of json/xml struct tags with unexported fields
This is a common source of bugs, particularly for those new to Go. Running this on a corpus of public code flagged 114 instances.

This check may need to be updated once issue 7363 is resolved.

LGTM=r
R=golang-codereviews, r
CC=bradfitz, golang-codereviews
https://golang.org/cl/91010047
2014-06-13 18:44:31 -07:00
Alan Donovan
de23e2b0c2 go/ssa: make Builtin capable of representing non-spec-defined intrinsics.
Also, define ssa:wrapnilchk intrinsic to check and gracefully
fail when a T method is dynamically invoked via a nil *T receiver.
+ Test.

A follow-up CL will add another intrinsic, ssa:memclr.

+ minor cleanups.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/101170044
2014-06-13 17:34:07 -04:00
Alan Donovan
38cb4c0966 go.tools/go/ssa: record ast.CallExpr.Rparen as Alloc.Pos() for varargs arrays.
+ pointer analysis test-case.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/108980043
2014-06-13 17:12:28 -04:00
Peter Collingbourne
ce1e99a260 go.tools/go/ssa: emit a recover block if the function's results are unnamed
It is easier for clients to recover from panics if the recover block
is always present. Otherwise, the client has to work around the lack
of a recover block by synthesizing a zero value return.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/87210044
2014-06-13 13:08:35 -04:00
Alan Donovan
f0ff511183 go/loader: make (*Config).Load() robust against I/O, scanner and parser errors.
Before, Load() would just fail.  Now, it gathers all frontend
errors (not just the first go/types error) in PackageInfo.Errors.

There are still cases where Load() can fail hard, e.g. errors in x_test.go
files.  That case is trickier to fix and remains a TODO item.

Also, make godoc display all scanner/parser/type errors in the source view.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/108940043
2014-06-13 11:32:46 -04:00
Andrew Gerrand
5a5dc64a96 go.tools/godoc: fix index reading and writing
In command godoc, set IndexEnabled when the -write_index flag is set.
Previously you would need to (unintuitively) set the -http flag to
achieve this.

In package godoc, set up the FS tree before loading the index, and
then return before starting the index refresh loop. Previously the
index would be loaded and then immediately refreshed, negating the
benefits of the on-disk index.

TBR=bradfitz
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/103370046
2014-06-13 16:49:32 +10:00
Andrew Gerrand
93b08999a7 go.tools/cmd/godoc: set corpus.MaxResults in appinit.go
LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/101220045
2014-06-13 15:20:15 +10:00
David Symonds
f895b43688 vet: Rearrange checkers to use a registration system.
This removes much of the AST logic out of main.go,
and makes it easier to build custom vet binaries

The trade-off in this change is for flexibility.
There's very little change in the per-check files,
a lot less code in main.go (specifically the AST walking
logic has shrunk), and it makes it much easier to build
custom vet binaries simply by dropping new source files
in the directory.

LGTM=josharian, r
R=r, josharian, kamil.kisiel
CC=golang-codereviews
https://golang.org/cl/83400043
2014-06-13 15:04:45 +10:00
Andrew Gerrand
229ca526b7 go.tools/cmd/godoc: remove useless code from index.go
This code was moved to a throttle method on Corpus but I guess it was
never deleted.

LGTM=crawshaw
R=golang-codereviews, crawshaw
CC=golang-codereviews
https://golang.org/cl/102350043
2014-06-13 12:42:11 +10:00
Robert Daniel Kortschak
6251f07ecd go.tools/present: correctly test empty argument
Updates golang/go#7613.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/105130046
2014-06-12 16:54:10 -07:00
Robert Daniel Kortschak
53915e22e2 go.tools/present: allow intentionally empty parameters
Fixes golang/go#7613.

LGTM=r
R=adg, r
CC=golang-codereviews
https://golang.org/cl/105070043
2014-06-12 15:45:26 -07:00
Alan Donovan
d014be43ae go.tools/go/types: remove PackageObj Selection - not needed
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/105920043
2014-06-12 18:05:33 -04:00
Robert Griesemer
f59b01c69b go.tools/go/types, exact: fix build for 1.2
Fixes golang/go#8192.

LGTM=bradfitz
R=bradfitz, adonovan
CC=golang-codereviews
https://golang.org/cl/105160043
2014-06-12 12:46:21 -07:00
Robert Griesemer
afafa2630f go.tools/go/types: export types.Checker (cleanup)
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/109850044
2014-06-12 11:13:58 -07:00
Alan Donovan
142566e529 go/ssa: avoid "premature optimization" of dead branch removal.
Blocks dominated by "if false" should be retained in the
initial SSA form so they remain visible to subsequent source
code analysis tools.

In any case, true compilers already need a stronger version of
this optimization so they can simplify CFGs such as this:
	const x, y = ...
        switch x {case y:...}
where a branch is constant but the comparison of constants
does not occur within an expression.

LGTM=gri
R=gri
CC=golang-codereviews, pcc
https://golang.org/cl/101250043
2014-06-12 11:31:41 -04:00
Robert Griesemer
0fa48054ca go.tools/go/types: comma-ok expressions return bool rather than untyped bool
Per the current spec.

Fixes golang/go#8188.

LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/101200043
2014-06-11 15:03:38 -07:00
Alan Donovan
30166088e4 go/ssa: remove optimization of 'rundefers'.
The SSA builder shouldn't be in the business of
interprocedural optimization, especially in the presence of
concurrency.

This causes the instruction count to increase by 0.03%.

LGTM=gri
R=gri, pcc
CC=golang-codereviews
https://golang.org/cl/105020045
2014-06-11 16:33:25 -04:00
Peter Collingbourne
cd36f52558 go.tools/go/ssa: add Max to Slice's SSA operand list
LGTM=adonovan
R=adonovan, bradfitz
CC=golang-codereviews
https://golang.org/cl/101160043
2014-06-11 16:16:19 -04:00
Alan Donovan
cc02c5be36 go/ssa: s/Capture/FreeVar/g
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/109820044
2014-06-11 14:04:45 -04:00
Alan Donovan
1edc750a9c go/ssa: cleanup: make NewFunction a member of *Program.
(since it always needs this field)

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/106960045
2014-06-11 14:03:40 -04:00