1
0
mirror of https://github.com/golang/go synced 2024-10-01 08:28:43 -06:00
Commit Graph

103 Commits

Author SHA1 Message Date
Alan Donovan
95bd0c4fdf go.tools/go/types: add (*PkgName).ImportedPackage method.
It returns the value formerly returned by Pkg(), i.e. the imported package.
Pkg() now returns the package enclosing the import statement,
which is consistent with all other Objects.

Fixes golang/go#8628.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/136090043
2014-09-02 18:12:08 -04:00
Oling Cat
5a1d3be754 go.tools/godoc/static/package.html: remove extra tag; indent with tabs.
LGTM=gri
R=golang-codereviews, gobot, rsc, gri
CC=golang-codereviews
https://golang.org/cl/120380044
2014-08-26 13:22:54 -07:00
Oling Cat
e14fb0e1ee go.tools/godoc/static: indent with tabs.
LGTM=gri
R=golang-codereviews, gobot, gri
CC=golang-codereviews
https://golang.org/cl/120390043
2014-08-26 13:21:29 -07:00
Andrew Gerrand
277e5a16d7 go.tools/godoc: mention sub-repos and package indexes on packages page
Also several cosmetic tweaks to the package page.

LGTM=r, bradfitz
R=bradfitz, r
CC=golang-codereviews
https://golang.org/cl/128490043
2014-08-21 09:53:57 +10: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
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
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
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
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
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
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
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
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
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
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
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
Alan Donovan
04427c85cf go/ssa: add Node interface: common parts of Value+Instruction, plus Operands/Referrers.
Also:
- extend Parent() to all Values and add to interface:
  (Builtin/Const/Global => nil; Function => Enclosing)
- hide Function.Enclosing since it's now redundant wrt Parent()
- make (*Function).String robust for synthetics without pkg object

LGTM=gri
R=gri
CC=golang-codereviews, khr
https://golang.org/cl/87580044
2014-06-11 13:14:06 -04:00
Rob Pike
6f17d00f0d go.tools: fix various minor issues found by go vet
LGTM=adonovan
R=adonovan
CC=golang-codereviews
https://golang.org/cl/96360048
2014-05-19 08:47:28 -07:00
Alex Brainman
63a1026f64 go.tools/godoc/analysis: convert path to url (fixes windows build)
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/94440043
2014-05-14 12:38:43 +10:00
Josh Bleecher Snyder
e6020f7229 go.tools/godoc/static: fix import path doc typo
LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/98970043
2014-05-05 17:42:00 -07:00
Shenghou Ma
35875c1a92 go.tools/cmd/godoc/static: fix text template for variable examples.
Fixes golang/go#7771.

LGTM=bgarcia
R=golang-codereviews, bradfitz, bgarcia
CC=golang-codereviews
https://golang.org/cl/87180044
2014-04-22 18:46:26 -04:00
Alan Donovan
f1247de572 go.tools/cmd/doc: make filename logic separator-agnostic
(Speculative fix for broken cmd/godoc test on Windows.)

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/90090043
2014-04-21 18:34:22 -04:00
Alan Donovan
4843aaee02 godoc: add very basic integration test of godoc -analysis=type.
Also: fix careless regression introduced yesterday.

LGTM=bgarcia
R=bgarcia
CC=golang-codereviews
https://golang.org/cl/88880043
2014-04-17 15:51:27 -04:00
Alan Donovan
503140c72e godoc: documentation of -analysis features.
The text and images are "baked in" to the godoc executable's
rodata section (~300KB) and are accessible from the godoc
server itself at /lib/godoc/analysis/help.html.

In due course, the page will become visible at
http://golang.org/lib/godoc/analysis/help.html, which will be
the canonical location for this doc (in announcements, etc).

The page is temporarily visible here, for those on the Google corp network:
http://172.26.104.127:7777/lib/godoc/analysis/help.html

Also:
- add link to new doc from source view pages.
- document -analysis flag in cmd/godoc/doc.go
- fix indentation of -analysis flag's help string

LGTM=gri
R=gri, bgarcia, r
CC=golang-codereviews
https://golang.org/cl/87110045
2014-04-16 16:35:08 -04:00
Alan Donovan
83a7488b3d go.tools/godoc: remove nil deference panic on loading error
Also:
- remove stale comment about line numbers.
- log a warning if file's package root not found.

LGTM=bgarcia
R=bgarcia
CC=golang-codereviews
https://golang.org/cl/88510044
2014-04-16 15:01:23 -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
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
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
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
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
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
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
Brad Garcia
aaca3a4f95 godoc: Remove bogus messages referring to "/target".
Fix package text display spacing.
Fixes golang/go#7395.

R=bradfitz, sameer
CC=golang-codereviews
https://golang.org/cl/68210043
2014-02-26 13:21:44 -05:00
Brad Garcia
61bd98e5b3 godoc: Fix m=src URLs.
For source code links, prepend /src/pkg if not already prefixed.
Fixes golang/go#7383.

R=bradfitz, sameer
CC=golang-codereviews
https://golang.org/cl/67110043
2014-02-21 19:51:51 -05:00
Brad Garcia
0cf8ab65b2 godoc: identifiers can contain underscores, not spaces.
Fixes golang/go#7382.

R=bradfitz, sameer
CC=golang-codereviews
https://golang.org/cl/67090043
2014-02-21 19:51:15 -05:00
Brad Garcia
804b9654fe godoc: Fix dereference of nil *SearchResult.
Fixes golang/go#7364.

R=bradfitz
CC=golang-codereviews, sameer
https://golang.org/cl/66470044
2014-02-20 11:26:05 -05:00
Andrew Gerrand
1a5e5b083b go.tools/godoc/redirect: remove race detector blog post redirect
Update golang/go#7275

LGTM=minux.ma, dvyukov
R=dvyukov, minux.ma
CC=golang-codereviews
https://golang.org/cl/60900044
2014-02-11 09:26:17 +11:00
Robert Griesemer
5351a1ccd2 go.tools/godoc: don't associate builtin nil with a type
Special case for (fake) package builtin: don't associate
any constant, variable, or factory function with a type.

Fixes golang/go#6645.

LGTM=bgarcia
R=bgarcia, r, bradfitz
CC=golang-codereviews
https://golang.org/cl/54820044
2014-02-04 10:26:38 -08:00
Brad Garcia
d682175c6e godoc: test fixes for recent cmdline changes.
Tests broken by:
https://code.google.com/p/go/source/detail?r=1666da2583f4&repo=tools

R=gri, adonovan
CC=golang-codereviews
https://golang.org/cl/58780043
2014-01-30 15:32:23 -05:00
Brad Garcia
2ca2bfc172 godoc: Fix commandline mode output.
Fix output of packages with multiple files.
Remove extra output when filter is requested.
Fixes golang/go#7115.

R=bradfitz, adg
CC=golang-codereviews
https://golang.org/cl/52750044
2014-01-30 06:28:19 -05:00
Brad Garcia
efd232e270 godoc: set expvar for http.ResponseWriter errors.
R=bradfitz
CC=adg, golang-codereviews
https://golang.org/cl/56680044
2014-01-29 10:53:45 -05:00
Brad Garcia
7ecad5bf71 godoc: periodically refresh package directory and search index.
R=adg, bradfitz
CC=golang-codereviews
https://golang.org/cl/55080043
2014-01-28 09:30:23 -05:00
Brad Garcia
26542a8bc5 godoc: Update identifier indexing tests.
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/48170043
2014-01-06 14:53:03 -05:00
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
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