1
0
mirror of https://github.com/golang/go synced 2024-11-05 21:36:12 -07:00
Commit Graph

628 Commits

Author SHA1 Message Date
Brad Garcia
27d851fc2c godoc: Add package identifiers to documentation indexing.
This allows us to show package synopsis in search results.
Fix skipping of test files (prefix changed from "test/" to "/test/").

R=bradfitz, bradfitz
CC=golang-codereviews
https://golang.org/cl/44790044
2014-01-06 13:26:25 -05:00
Brad Garcia
a28efa5d8c godoc: add ability to change or disable the display of search results.
The display of search results can now be changed. A slice of functions for displaying the results can now be provided.  By default, three functions are provided to display documentation, source code, and textual results.
This makes it possible to replace them with equivalents that, say,
obtain search results from alternative source code search engines.

R=bradfitz, adg
CC=golang-codereviews
https://golang.org/cl/43470043
2014-01-06 09:51:01 -05:00
Francesc Campoy
5f5d42a466 go.tools/present: links with the prefix "javascript:" should be executed in the same window.
Using url.Parse instead of more ad hoc solution.

R=r
CC=golang-codereviews
https://golang.org/cl/47320043
2014-01-03 14:51:34 -08:00
Robert Griesemer
822669c658 go.tools/importer: fix field package for anonymous fields
Anonymous field names are emitted as "" in the export data
since the actual name can be reconstructed easily from the
field's type name. But "" names are not exported names and
thus the respective qualified name emits complete package
information even if the actual field name is exported. Fix
the package upon import.

R=adonovan
CC=golang-codereviews
https://golang.org/cl/42090044
2014-01-03 14:08:12 -08:00
Robert Griesemer
df08273253 go.tools/gcimporter: use imported package info for anonymous fields
The package of a struct field is independent of the type of the
struct field - the old code was technically not correct. That said,
it does not seem possible (or very difficult) to create a test case
because for exported anonymous fields that field package doesn't matter
(it's not needed for name identity), and non-exported anonymous fields
cannot be accessed from an imported package.

R=adonovan
CC=golang-codereviews
https://golang.org/cl/47560043
2014-01-03 11:37:20 -08:00
Robert Griesemer
6770b5cdca go.tools/go/importer: more cleanups
R=adonovan
CC=golang-codereviews
https://golang.org/cl/34660046
2014-01-03 09:12:32 -08:00
Francesc Campoy
53273c1d55 go.tools: Expose filename rather than extension only, needed for new tour.
R=adg, r
CC=golang-codereviews
https://golang.org/cl/43470050
2014-01-02 16:03:56 -08:00
Alan Donovan
8c66e887f7 go.tools/ssa: a blocking select's implicit "default" case should runtime-panic, not fall through.
Although such a control-flow path is impossible by
construction, we must avoid no-arg returns (even if
unreachable) in non-void functions.

Tested by adding a sanity-check that ssa.Return has the correct arity.
Also: added ssautil.Switches() test.

Fixes golang/go#7702

R=gri, axwalk
CC=golang-codereviews
https://golang.org/cl/46520043
2014-01-02 15:12:23 -05:00
Pavel Zinovkin
3658622d3e go.tools/cmd/goimports: Fixed url
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/40610046
2014-01-02 11:02:13 -08:00
Robert Griesemer
10f0067eb1 go.tools/go.types: cleanups
Per feedback for CL 37250044.

R=adonovan
CC=golang-codereviews
https://golang.org/cl/47150043
2014-01-02 10:07:48 -08:00
Francesc Campoy
3d2d158b9d go.tools/present: Open links with local (non absolute) URLs in the same window.
This allows having links from one slide to another one in the same presentation.
Also it is needed in the new tour to cross reference lessons.

R=r
CC=golang-codereviews
https://golang.org/cl/46130043
2013-12-28 21:10:40 -08:00
Robert Griesemer
30645c4bc6 go.tools/go/importer: fine-tuning of export format, test against std lib
(TBR adonovan)

- provide version string rather than version number (more flexible)
- match naming of tag constants with documentation (forth-coming)
- more formats for constant values (1-byte booleans, short 64bit
  values, support for floating point numbers +123p+45)
- more regular format for signatures: always print with type tag;
  this permits (future) sharing of identical signatures and possibly
  large export data size reduction
- test export and import of all type-checked std library packages
- compare import of all std library packages against corresponding
  import of gc-generated export data and verify that the packages
  match 100% (except for floating point values which are exact when
  coming from go/types, and possibly inexact when coming from gc)

On average, export data generated by the importer is ~28% of the size
of the gc-generated export data for corresponding packages of the std
library:

        package 		size	gc size

        archive/tar		2945	12030	24%
        archive/zip		4122	15796	26%
        bufio			1776	6171	28%
        bytes			2540	8006	31%
        compress/bzip2		146	419	34%
        compress/flate		2305	6356	36%
        compress/gzip		4262	17917	23%
        compress/lzw		336	832	40%
        compress/zlib		2503	9814	25%
        container/heap		255	527	48%
        container/list		653	2971	21%
        container/ring		246	707	34%
        crypto			368	1015	36%
        crypto/aes		219	499	43%
        crypto/cipher		809	1875	43%
        crypto/des		254	636	39%
        crypto/dsa		3324	15609	21%
        crypto/ecdsa		3833	18567	20%
        crypto/elliptic		3801	17417	21%
        crypto/hmac		205	459	44%
        crypto/md5		206	413	49%
        crypto/rand		3070	15047	20%
        crypto/rc4		180	443	40%
        crypto/rsa		4205	17941	23%
        crypto/sha1		208	414	50%
        crypto/sha256		272	555	49%
        crypto/sha512		274	555	49%
        crypto/subtle		247	1157	21%
        crypto/tls		13769	48330	28%
        crypto/x509		10716	40556	26%
        crypto/x509/pkix	5670	24616	23%
        database/sql		4227	15957	26%
        database/sql/driver	1239	2806	44%
        debug/dwarf		5165	12066	42%
        debug/elf		14205	36401	39%
        debug/goobj		992	2495	39%
        debug/gosym		1808	4798	37%
        debug/macho		4560	13173	34%
        debug/pe		3694	10530	35%
        encoding		261	387	67%
        encoding/ascii85	368	1541	23%
        encoding/asn1		479	1661	28%
        encoding/base32		608	2636	23%
        encoding/base64		610	2636	23%
        encoding/binary		1006	3591	28%
        encoding/csv		2287	8405	27%
        encoding/gob		9161	30565	29%
        encoding/hex		384	1331	28%
        encoding/json		6564	23334	28%
        encoding/pem		208	529	39%
        encoding/xml		7964	27220	29%
        errors			52	277	18%
        expvar			955	2978	32%
        flag			2475	18028	13%
        fmt			1141	3141	36%
        go/ast			11595	41019	28%
        go/build		3736	13920	26%
        go/doc			2647	9523	27%
        go/format		1310	5010	26%
        go/parser		4346	18525	23%
        go/printer		1737	6442	26%
        go/scanner		2360	8598	27%
        go/token		2290	7599	30%
        hash			215	595	36%
        hash/adler32		217	391	55%
        hash/crc32		399	1475	27%
        hash/crc64		324	1327	24%
        hash/fnv		338	3964	8%
        html			80	253	31%
        html/template		7981	37471	21%
        image			4270	18894	22%
        image/color		845	3154	26%
        image/color/palette	121	319	37%
        image/draw		947	4807	19%
        image/gif		1468	6611	22%
        image/jpeg		971	4534	21%
        image/png		880	4432	19%
        index/suffixarray	3702	13960	26%
        io			2049	6117	33%
        io/ioutil		2845	12060	23%
        log			2416	10241	23%
        log/syslog		3102	12208	25%
        math			2361	6008	39%
        math/big		3648	12250	29%
        math/cmplx		473	1542	30%
        math/rand		786	2002	39%
        mime			180	595	30%
        mime/multipart		2761	9338	29%
        net			10593	34352	30%
        net/http		24542	84065	29%
        net/http/cgi		12859	50970	25%
        net/http/cookiejar	2845	12429	22%
        net/http/fcgi		12331	49111	25%
        net/http/httptest	18953	75243	25%
        net/http/httputil	13994	54386	25%
        net/http/pprof		12153	49039	24%
        net/mail		1803	8599	20%
        net/rpc			18503	69044	26%
        net/rpc/jsonrpc		1063	2737	38%
        net/smtp		11775	46821	25%
        net/textproto		2684	8678	30%
        net/url			767	2886	26%
        os			5712	20293	28%
        os/exec			4705	18350	25%
        os/signal		125	330	37%
        os/user			234	720	32%
        path			231	770	30%
        path/filepath		2236	9721	23%
        reflect			4518	13467	33%
        regexp			3608	11167	32%
        regexp/syntax		2184	5157	42%
        runtime			1563	3407	45%
        runtime/cgo		36	66	54%
        runtime/debug		1714	8010	21%
        runtime/pprof		485	1358	35%
        runtime/race		38	43	88%
        sort			748	2658	28%
        strconv			949	2573	36%
        strings			1846	6220	29%
        sync			712	1970	36%
        sync/atomic		1089	2506	43%
        syscall			38975	79396	49%
        testing			3734	13626	27%
        testing/iotest		332	2378	13%
        testing/quick		4411	16434	26%
        text/scanner		1821	5349	34%
        text/tabwriter		1593	4937	32%
        text/template		6882	33329	20%
        text/template/parse	3946	12760	30%
        time			3031	9703	31%
        unicode			3148	8676	36%
        unicode/utf16		163	760	21%
        unicode/utf8		475	1122	42%

        total			463641	1644936	28%

R=adonovan
TBR=adonovan
CC=golang-codereviews
https://golang.org/cl/37250044
2013-12-20 16:43:31 -08:00
Robert Griesemer
e405e03b16 go.tools/go/types: complete set of Interface accessors
Also: Provide GcCompatibilityMode for printing types
(intended for testing with gc-generated export data
only).

(TBR adonovan)

R=adonovan
TBR=adonovan
CC=golang-codereviews
https://golang.org/cl/44780043
2013-12-20 16:35:31 -08:00
Rob Pike
8f712fcb98 .hgignore: add comment setting policy
R=golang-codereviews, iant
CC=golang-codereviews
https://golang.org/cl/44840044
2013-12-20 16:28:57 -08:00
Robert Griesemer
e2acb64f86 go.tools/go/types: submit missed file (fix build)
R=adonovan
CC=golang-codereviews
https://golang.org/cl/38130044
2013-12-20 15:51:04 -08:00
Anthony Martin
a1406b40c5 go.tools/ssa/interp: fix Plan 9 build for Brad
R=golang-codereviews, rsc, 0intro
CC=golang-codereviews
https://golang.org/cl/26500043
2013-12-20 15:20:51 -08:00
Robert Griesemer
d4da60d38f go.tools/gc/importer: fix struct tags and parameter names
R=iant
CC=golang-codereviews
https://golang.org/cl/42280046
2013-12-20 15:17:16 -08:00
Russ Cox
87ccd3155a codereview: switch defaultcc to golang-codereviews
See this thread for background:
https://groups.google.com/forum/#!topic/golang-dev/xG7vPi21r8g

R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/41500044
2013-12-20 10:54:33 -05:00
Andrew Gerrand
efcc5ffb58 go.tools/cmd/goimports: rename README to doc.go
README is a GitHub thing. Let's do the godoc thing.

R=golang-dev, crawshaw
CC=golang-dev
https://golang.org/cl/44030046
2013-12-20 09:26:26 +11:00
Rob Pike
bae6bf6180 go.tools/cmd/vet: improve error message for build tag problems
Fixes golang/go#6979.

R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/37720048
2013-12-18 16:06:56 -08:00
Robert Griesemer
00fab17bd2 go.tools/ssa/interp: fix build (add missing runtime function)
Introduced by CL 41860043.

R=adonovan
TBR=adonovan
CC=golang-dev
https://golang.org/cl/42950044
2013-12-18 11:49:45 -08:00
Robert Griesemer
4e3127283a go.tools/go/gcimporter: adjust for new .a file format
R=rsc, r
CC=golang-dev
https://golang.org/cl/41510044
2013-12-18 10:53:59 -08:00
Brad Fitzpatrick
b6e674b8e7 go.tools/imports: fix fileset mismatch bug
Fixes golang/go#6884

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/43890043
2013-12-18 09:09:37 -08:00
David Crawshaw
64c6d0410b go.tools/imports: fix test broken in b33d2e25015b6793aac4f9dcef3d8a8d1c9243b3
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/41950048
2013-12-18 03:44:50 -08:00
David Crawshaw
c87866116c go.tools/imports: move goimports from github to go.tools.
From revision d0880223588919729793727c9d65f202a73cda77.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/35850048
2013-12-17 21:21:03 -05:00
Robert Griesemer
53dfbf8a00 go.tools: fix build
Missed a couple of places with previous CL.

R=adonovan
TBR=adonovan
CC=golang-dev
https://golang.org/cl/40850046
2013-12-17 16:21:23 -08:00
Robert Griesemer
74d33a9c33 go.tools/go/types: use types.ChanDir instead of ast.ChanDir
Clearer code and fewer dependencies on go/ast.

R=adonovan
CC=golang-dev
https://golang.org/cl/43630043
2013-12-17 15:45:01 -08:00
Andrew Gerrand
1de4f6df60 go.tools/godoc/static: add 'fmtImportEl' option to playground
The 'fmtImportEl' option lets the called specify a checkbox element
that determines whether to send the 'imports=true' key/value pair when
calling '/fmt'.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/43240043
2013-12-18 09:32:51 +11:00
Dmitriy Vyukov
676ac131e1 dashboard/app: properly limit commit description length
Ensure that we do not split UTF-8 rune in half.
Otherwise appengine python scripts will break badly.

R=adg, r
CC=golang-dev
https://golang.org/cl/42530043
2013-12-17 12:14:27 +04:00
Chris Manghane
9e3292f107 go.tools/dashboard: Turn off multilib compilation in gccgo.
R=adg
CC=golang-dev
https://golang.org/cl/43020043
2013-12-16 14:50:22 -08:00
Chris Manghane
2cbda9de61 go.tools/dashboard: Fix incorrect parsing of log hash.
R=adg
CC=golang-dev
https://golang.org/cl/43000043
2013-12-16 14:50:09 -08:00
Robert Griesemer
a02c76070b go/importer: fix build (disable tests that won't run on builders)
R=adonovan
TBR=adonovan
CC=golang-dev
https://golang.org/cl/43010043
2013-12-16 14:44:22 -08:00
Brad Fitzpatrick
ae534bcb6c astutil: fix a comment corruption case
This fixes a case where adding an import when there are is no
existing import declaration can corrupt the position of
comments attached to types. This was the last known
goimports/astutil corruption case.

See golang.org/issue/6884 for more details.

Unfortunately this requires changing the API to add a
*token.FileSet, which we should've had before.  I will update
goimports (the only user of this API?) immediately after
submitting this.

This CL also contains a hack (used only in this case of no
imports): rather than fix the comment positions by hand
(something that only Robert might know how to do), it instead
just prints the AST, manipulates the source, and re-parses
the AST. We can fix up later.

Fixes golang/go#6884

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/38270043
2013-12-16 14:43:29 -08:00
Robert Griesemer
5eb4fdc120 go.tools/go/importer: simplified exporter/importer
By using a simple (graph-based) serialization algorithm
and binary encoding, a significantly more compact export
data format is achieved than what the current compilers
use. Furthermore, the exporter and importer are completely
symmetric algorithms that are compact, and much easier to
change/expand.

R=adonovan
CC=golang-dev
https://golang.org/cl/42960043
2013-12-16 14:28:17 -08:00
Robert Griesemer
91abc02562 go.tools/go/types: print interface methods in sorted order
Required for testing code of clients.

R=adonovan
CC=golang-dev
https://golang.org/cl/35940049
2013-12-16 13:53:08 -08:00
Brad Fitzpatrick
59db975409 godoc: limit concurrency to local disk filesystem
Not for Go 1.2.  Still needs a flag.

Linux at least (and likely other OSes) don't like you doing
a few hundred readdirs at once and spawing as many threads.

R=golang-dev, adg, jeremyjackins
CC=golang-dev
https://golang.org/cl/30620043
2013-12-16 11:25:50 -08:00
Robin Eklind
01caf7ba7e ssa: Update the location of the ssadump command in an example comment.
R=golang-dev, adonovan
CC=golang-dev
https://golang.org/cl/42420043
2013-12-16 10:05:40 -05:00
Alan Donovan
8b9d1fd507 go.tools/oracle: implements: now shows whole-program implements relation for selected type.
(Previously it showed the implements relation for all types within the query package.)

R=crawshaw
CC=golang-dev
https://golang.org/cl/42000043
2013-12-13 18:00:55 -05:00
Alan Donovan
f119874203 go.tools/oracle: improvements to command set and performance.
Command set:
- what: an extremely fast query that parses a single
  file and returns the AST stack, package name and the
  set of query modes that apply to the current selection.
  Intended for GUI tools that need to grey out UI elements.
- definition: shows the definition of an identifier.
- pointsto: the PTA features of 'describe' have been split
  out into their own command.
- describe: with PTA stripped out, the cost is now bounded by
  type checking.

Performance:
- The importer.Config.TypeCheckFuncBodies predicate supports
  setting the 'IgnoreFuncBodies' typechecker flag on a
  per-package basis.  This means we can load dependencies from
  source more quickly if we only need exported types.
  (We avoid gcimport data because it may be absent or stale.)
  This also means we can run type-based queries on packages
  that aren't part of the pointer analysis scope. (Yay.)
- Modes that require only type analysis of the query package
  run a "what" query first, and restrict their analysis scope
  to just that package and its dependencies (sans func
  bodies), making them much faster.
- We call newOracle not oracle.New in Query, so that the
  'needs' bitset isn't ignored (oops!).  This makes the
  non-PTA queries faster.

Also:
- removed vestigial timers junk.
- pos.go: existing position utilties split out into own file.
  Added parsePosFlag utility.
- numerous cosmetic tweaks.

+ very basic tests.

To do in follow-ups:
- sophisticated editor integration of "what".
- better tests.
- refactoring of control flow as described in comment.
- changes to "implements", "describe" commands.
- update design doc + user manual.

R=crawshaw, dominik.honnef
CC=golang-dev, gri
https://golang.org/cl/40630043
2013-12-13 10:04:55 -05:00
Robert Griesemer
3df3227c35 go.tools/go/exact: fix bug introduced with CL 41170043
R=adonovan
CC=golang-dev
https://golang.org/cl/37820052
2013-12-12 14:18:40 -08:00
Robert Griesemer
e2828468ff go.tools/go/exact: serialization support and better unknown handling
- fixed various imprecise doc strings
- consistent handling of unknown values

R=adonovan
CC=golang-dev
https://golang.org/cl/41170043
2013-12-12 13:43:00 -08:00
Robert Griesemer
4728c2f3f6 go.tools/go/types: turn off internal debug mode
- much improved performance
- enable when testing changes

R=adonovan
CC=golang-dev
https://golang.org/cl/36480049
2013-12-12 13:32:36 -08:00
Robert Griesemer
693727787e go.tools/go/types/typemap: fix formatting verb
(%p is trouble if the interface value is not a pointer)

R=adonovan
CC=golang-dev
https://golang.org/cl/41440043
2013-12-12 12:12:32 -08:00
Alan Donovan
036b7d3489 go.tools/types: skip "imported but not used" check if IgnoreFuncBodies.
Obviously in that mode, we can't correctly diagnose such
errors, so we shouldn't attempt it (and emit false positives).

R=gri
CC=golang-dev
https://golang.org/cl/41080043
2013-12-11 21:12:08 -05:00
Robert Griesemer
11cfd4a636 go.toools/go/types: clearer comment (per adonovan)
R=adonovan
CC=golang-dev
https://golang.org/cl/40860045
2013-12-11 10:48:17 -08:00
Joel Sing
130693e419 go.tools/dashboard/builder: do not fatal on subrepo fetch errors
When fetching repos it is not uncommon for a 500 or 503 to be returned
from code.google.com. When this happens, log the error and continue so
that we try again later, rather than treating this as fatal.

R=adg, dvyukov
CC=golang-dev
https://golang.org/cl/38720044
2013-12-11 23:47:31 +11:00
Alan Donovan
26d5173f5e go.tools/oracle: "callees": skip pointer analysis at static call sites.
This improves both performance (most calls are static) and
precision (e.g. for static calls in dead code).

Also, break callees() function into smaller ones.

R=crawshaw
CC=golang-dev
https://golang.org/cl/38740045
2013-12-10 10:16:35 -05:00
Alan Donovan
5d70784aca go.tools/pointer: replace Config.Print (callback) with a Result.PrintCalls (map).
This avoids leaking nodeids into client code before the
analysis has had a chance to run the (forthcoming) constraint
optimizer, which renumbers them.

R=crawshaw
CC=golang-dev
https://golang.org/cl/39410043
2013-12-10 09:15:39 -05:00
Andrew Gerrand
05f8c7dc66 go.tools/dashboard/app: app index.yaml
This is equivalent to the previously-reviewed change to Dmitry's
performance dashboard repo clone:
https://golang.org/cl/35490043

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/39840043
2013-12-10 16:43:15 +11:00
Andrew Gerrand
922f326cd7 go.tools/dashboard/app: fix tests and add TODO to reall fix them
This change is a really nasty hack to preserve the magic header
across requests. The nasty hack will go away once we refactor these
tests to use the new "appengine/aetest" package instead.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/39230043
2013-12-10 15:30:35 +11:00