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

126 Commits

Author SHA1 Message Date
Alan Donovan
96af1504f6 go/ssa: add list-of-tests constant to generated testmain package
And log its value in godoc -analysis.

Related to issue 8968

Change-Id: I96a96922a3fa5c434c69e0faff1cc8ec4686b6f2
Reviewed-on: https://go-review.googlesource.com/3154
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-01-22 22:45:41 +00:00
Alan Donovan
4d45c85020 go/types: expose IsInterface predicate, eliminating 6 copies
Change-Id: I3704d7bd7a11f691c66556c1b77ef79a503d2fe9
Reviewed-on: https://go-review.googlesource.com/2173
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-21 18:49:27 +00:00
Shenghou Ma
4d81e11d78 godoc/redirect: update the rules for /cl/ redirect
If id is a number greater than 150k, then it is a Rietveld CL, otherwise
treat it as a Gerrit change id.

Also add support for /cl/ID/, because go commit 0edafefc36 uses this
form.

Change-Id: I46575e3284faaa727e346b34bbc46ab248cf12b3
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/1283
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-22 03:14:31 +00:00
Shenghou Ma
a47975eda8 cmd/eg, godoc/redirect: update remaining code.google.com links
Change-Id: I67da9e0c0c511c19e5b5296fbcf46f641273a7bb
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/1515
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-18 07:48:40 +00:00
Oling Cat
443d37c586 godoc/static/analysis: update a link to new home
While we're at it, fix some bad tags and wrap one long line.

Change-Id: I4808b4645b7d18c4320b0969ab53fb244d6f169d
Reviewed-on: https://go-review.googlesource.com/1520
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-18 03:22:47 +00:00
Andrew Gerrand
55402a2b46 godoc/redirect: support loading hg->git change map from a file
This isn't exposed through the godoc binary, as it will only be
used by the Google-specific deployment of godoc.

Change-Id: Id5808f3adcb7eb36a7ccd6e4960ce3f01179fe51
Reviewed-on: https://go-review.googlesource.com/1567
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-15 06:48:23 +00:00
David Symonds
24257c8cd2 tools: add import comments.
Change-Id: Idda6e64580432cb9a731e4ebf4005ee4ceb4202d
Reviewed-on: https://go-review.googlesource.com/1244
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-09 22:42:16 +00:00
Shenghou Ma
6e0e92af7e godoc/redirect: if id in /cl/{id} is less than 150k, treat as Gerrit CL id
Change-Id: Id69c00d908d18151486007ec03da5495b34b05f5
Reviewed-on: https://go-review.googlesource.com/1223
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-09 20:48:31 +00:00
Andrew Gerrand
c73666300b x/tools/godoc/redirect: point to new git/github URLs
LGTM=dsymonds
R=dsymonds
CC=golang-codereviews
https://golang.org/cl/187920043
2014-12-08 10:39:42 +11:00
Andrew Gerrand
566014162e x/tools/godoc/redirect: handle Rietveld and Gerrit CLs at /cl/
LGTM=rsc, dsymonds
R=rsc, dsymonds
CC=golang-codereviews
https://golang.org/cl/177260043
2014-11-24 13:25:05 +11:00
Andrew Gerrand
a3be5384d5 x/tools/godoc/redirect: add redirect for Gerrit reviews at /review/
LGTM=rsc, bradfitz
R=bradfitz, rsc
CC=golang-codereviews
https://golang.org/cl/178960043
2014-11-19 08:51:39 +11:00
Andrew Gerrand
5ebbcd132f go.tools: use golang.org/x/... import paths
Rewrite performed with this command:
  sed -i '' 's_code.google.com/p/go\._golang.org/x/_g' \
    $(grep -lr 'code.google.com/p/go.' *)

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/170920043
2014-11-10 08:50:40 +11:00
Andrew Gerrand
ef648ad89b go.tools/godoc/static: replace bake.sh with "go generate" rule
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/164490043
2014-11-05 16:52:40 +11:00
Alex Brainman
30f7e63100 go.tools/godoc: do not assume that all windows paths are delimited by os.PathSeparator (fixes build)
Fixes golang/go#9003.

LGTM=adg
R=golang-codereviews, adg
CC=golang-codereviews
https://golang.org/cl/161420043
2014-10-28 12:26:29 +11:00
Alan Donovan
e2e1830b02 godoc/analysis: remove obsolete comment.
The bug it refers to is now fixed, and the alternative
implementation it suggests is not an improvement.

LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/151620044
2014-10-23 13:42:24 -04:00
Andriy Lytvynov
b916c559e7 cmd/godoc: do not apply package path restrictions onto GOROOT when indexing.
Fixes golang/go#6925.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/156540043
2014-10-23 09:34:01 -07:00
Hana Kim
13837d25ef godoc: exclude internal packages and cmd from packages page.
Internal packages are now only included with ?m=all

Fixes golang/go#8879

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/155910044
2014-10-13 18:47:02 +02: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
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
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
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
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
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