A few files have been forked and tagged "go1.5,!go1.6" to work around
minor API changes between the two types packages:
- constant.Value.String() in oracle/describe.go and its tests;
- constant.ToInt must now be called before constant.Int64Val.
- types.Config{Importer: importer.Default()} in a number of places
- go/types/typeutil/import_test.go uses lowercase names to avoid 'import "C"'.
Files in go/types/typesutil, missing from my previous CL, have been
tagged !go1.5; these files will be deleted in February.
All affected packages were tested using 1.4.1, 1.5, and ~1.6 (tip).
Change-Id: Iec7fd370e1434508149b378438fb37f65b8d2ba8
Reviewed-on: https://go-review.googlesource.com/18207
Reviewed-by: Robert Griesemer <gri@golang.org>
This change will ensure that the tree continues to work with go1.4.1.
All files continue to depend on golang.org/x/tools/go/types, but in a
follow-up change, I will switch the primary files to depend on the
standard go/types package. Another (smaller) set of files will be
forked and tagged, this time !1.6, due to API differences between the
two packages.
All tests pass using 1.4.1, 1.5, and ~1.6 (tip).
Change-Id: Ifd75a6330e120957d646be91693daaba1ce0e8c9
Reviewed-on: https://go-review.googlesource.com/18333
Reviewed-by: Robert Griesemer <gri@golang.org>
godoc still runs on App Engine (not Managed VMs). The metadata server is only
available from Compute Engine and Managed VMs, but not App Engine.
Change-Id: I0e5e9ef3f169f6d24ca7562df744c8f1556b825f
Reviewed-on: https://go-review.googlesource.com/17391
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
- add tests for Open, ReadDir, and Stat funcs
- add tests for Seek of Open()
- simplify internal handling of absolute vs. "zip" paths
- fix handling of "/"
The fix special cases this scenario, leaving the codepath for all
other file paths the same. Specifically,
- Exported funcs call stat(), so stat("/") is handled by simply
returning 0 to indicate all entries are (effectively) prefixed
by "/" and zipFI{"", nil} because "/" has no name and nil
indicates it is a directory.
- ReadDir("/") is further handled by seeding the existing lookup
logic with "" instead of what would have been "/". This is
necessary because, per the zipfs spec, the zip file entries MUST
NOT start with "/", so using "/" would incorrectly match nothing.
This works because seeding lookup with "" (correctly) matches
all files and then the following, existing logic (correctly) pares
things down to just the files in the root directory; not in any
subdirectories.
Verified that godoc -zip still works.
Fixesgolang/go#12743
Change-Id: Icb5f01b8a29cefa4e2820135f318894042970301
Reviewed-on: https://go-review.googlesource.com/16925
Reviewed-by: Andrew Gerrand <adg@golang.org>
These codes were initially included because of a miscommunication.
They should not be in the list at all.
Fixesgolang/go#12747
Change-Id: I1a53e9c7be8edf5e1dbb95cd03101b93023a12c1
Reviewed-on: https://go-review.googlesource.com/15082
Reviewed-by: Andrew Gerrand <adg@golang.org>
These were built inside Google but have been in production for years.
Move them into the public tools repository so that they can be more
easily maintained.
This is step one to moving the entire golang.org deployment process out
of Google's internal source repository.
Change-Id: I72f875c5020b3f58f1c0cea1d19268e0f991833f
Reviewed-on: https://go-review.googlesource.com/14842
Reviewed-by: Chris Broadfoot <cbro@golang.org>
This will permit us to serve *.golang.org to Chinese users.
Change-Id: I5217753aa67931522c7e6be106477534c99a20b2
Reviewed-on: https://go-review.googlesource.com/14194
Reviewed-by: Andrew Gerrand <adg@golang.org>
In Safari a JavaScript error in personalizeInstallInstructions prevents
the featured articles from displaying. startsWith is an ES6-only feature.
Fixesgolang/go#12283
Change-Id: I9f471362cdac0243758e482ed3a21b0d6aa48c8b
Reviewed-on: https://go-review.googlesource.com/13841
Reviewed-by: Andrew Gerrand <adg@golang.org>
(This time for sure!)
Change-Id: Ic9b7dbfb527af9aa029365f7a91bd3b949985431
Reviewed-on: https://go-review.googlesource.com/13220
Reviewed-by: Chris Broadfoot <cbro@google.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
This change allows the download page to redirect the user to
/doc/install?download=filename so the user can see installation
instructions specific to the file they are downloading.
This is related to this change to the core repo:
https://golang.org/cl/13151
Change-Id: Ia81344ed913aea1d1a4deed021c0e07f7360ff68
Reviewed-on: https://go-review.googlesource.com/13180
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Without this change, a h3 below a h2 looks weird.
Change-Id: I96cd1545615547b03460cf6896acd0df1abfc1a1
Reviewed-on: https://go-review.googlesource.com/13052
Reviewed-by: Chris Broadfoot <cbro@golang.org>
The list of sub-repos at the bottom of the /pkg
page is unfortunately hand-maintained. With this
commit, it is now up-to-date and ready to get out
of date again.
Fixesgolang/go#9081.
Change-Id: I3dc5e11ed65f53ea7299a259575ebcb6ad6b13ec
Reviewed-on: https://go-review.googlesource.com/12512
Reviewed-by: Andrew Gerrand <adg@golang.org>
I frequently type one when the other is required.
Make them interchangeable.
Change-Id: Ib98d2b67aa42d79e6a8e9fd29fdea17048378eb6
Reviewed-on: https://go-review.googlesource.com/12509
Reviewed-by: Andrew Gerrand <adg@golang.org>
Importing "expvar" exports server variables on /debug/vars by default. This
raises security concerns in some environments. Users should opt-in to this
instead. If users need godoc metrics, we can provide a function in the godoc
package to read them.
Change-Id: Ie12e695d5958b646e82e7e00de651cc1913aa98d
Reviewed-on: https://go-review.googlesource.com/12270
Reviewed-by: Andrew Gerrand <adg@golang.org>
The optional Qualifier function determines what prefix to attach to
package-level names, enabling clients to qualify packages in different
ways, for example, using only the package name instead of its complete
path, or using the locally appropriate name for package given a set of
(possibly renaming) imports.
Prior to this change, clients wanting this behavior had to copy
hundreds of lines of complex printing logic.
Fun fact: (*types.Package).Path and (*types.Package).Name are valid
Qualifier functions.
We provide the RelativeTo helper function to create Qualifiers so that
the old behavior remains a one-liner.
Fixesgolang/go#11133
Change-Id: Ibd63f639c7b3aa1738826d6165f2d810efeb8293
Reviewed-on: https://go-review.googlesource.com/11692
Reviewed-by: Robert Griesemer <gri@golang.org>
Mobile-friendly design overlooked indentation in table of contents
for article table of contents; this change restores indentation.
Change-Id: I9a3013497e1659ebfb657a8fb9374b8ad9b04b16
Reviewed-on: https://go-review.googlesource.com/11582
Reviewed-by: Andrew Gerrand <adg@golang.org>
This change makes golang.org responsive, including a top
bar menu and appropriate font sizing. The result is a
website that looks pleasing and is functional both on
mobile and on desktop. Also added a few print styles so
the site looks great on paper or PDF.
Change-Id: I16ee25ef4afde2002f240aec0804414bfb172a24
Reviewed-on: https://go-review.googlesource.com/9062
Reviewed-by: Chris Broadfoot <cbro@golang.org>
When Stat() or IsDir() return errors, close the file to avoid a leak.
Change-Id: I46d5e34c3443413ca674f2a703d033d945c21efa
Reviewed-on: https://go-review.googlesource.com/10557
Reviewed-by: Minux Ma <minux@golang.org>
The loader package now loads, parses, and type-checks a whole program
from source, and that is all.
Also:
- simplified loader logic
- ssa.Create is gone; use ssautil.CreateProgram.
- ssautil.LoadPackage renamed to BuildPackage.
It is now independent of go/types' Import hook and the Packages map.
- ssadump: -importbin flag removed.
The value of this flag was that it caused the tool to print IR
for only a single package; this is now the normal behaviour.
Fixes#9955
Change-Id: I4571118258ab1a46dccece3241b7dc51401a3acc
Reviewed-on: https://go-review.googlesource.com/8953
Reviewed-by: Robert Griesemer <gri@golang.org>
Running 'godoc -src' would end up with concatenated sources:
$ godoc -src github.com/bradfitz/http2 Frame
// a frameParser parses a frame given its FrameHeader and payload
// bytes. The length of payload will always equal fh.Length (which
// might be 0).
type frameParser func(fh FrameHeader, payload []byte) (Frame, error)//
A Frame is the base interface implemented by all frame types.
// Callers will generally type-assert the specific frame type:
// *HeadersFrame, *SettingsFrame, *WindowUpdateFrame, etc.
//
// Frames are only valid until the next call to Framer.ReadFrame.
type Frame interface {
Unconditionnally insert two newlines:
$ godoc -src github.com/bradfitz/http2 Frame
// a frameParser parses a frame given its FrameHeader and payload
// bytes. The length of payload will always equal fh.Length (which
// might be 0).
type frameParser func(fh FrameHeader, payload []byte) (Frame, error)
// A Frame is the base interface implemented by all frame types.
// Callers will generally type-assert the specific frame type:
// *HeadersFrame, *SettingsFrame, *WindowUpdateFrame, etc.
//
// Frames are only valid until the next call to Framer.ReadFrame.
type Frame interface {
Fixes#9726.
Change-Id: I51ee04e53d4962c890ea601125eda8fce84d6a46
Reviewed-on: https://go-review.googlesource.com/7681
Reviewed-by: Robert Griesemer <gri@golang.org>
Change to match searchdoc.html which works.
(Was referring to "$val.Idents" in line 26, but "$val" here is
already an element of Idents.)
Also clarify naming and comments for makestatic.
Fixesgolang/go#10022.
Change-Id: Ia3f2fdadd5d10f31a1825e8db966b6e92da2b93e
Reviewed-on: https://go-review.googlesource.com/6236
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
...since the zero value is more useful by far.
This is a breaking API change, obviously. (One or two tests in this
CL have intentional been left using the zero value, i.e., they now
load source.)
Change-Id: I42287bfcdb1afef8ee84e5eac12534dd0a1fd5d2
Reviewed-on: https://go-review.googlesource.com/5653
Reviewed-by: Robert Griesemer <gri@golang.org>
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>
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>
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>
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>
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
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
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
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.
Fixesgolang/go#8237
LGTM=bradfitz
R=gri, bradfitz
CC=golang-codereviews
https://golang.org/cl/141540043
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
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.
Fixesgolang/go#8628.
LGTM=gri
R=gri
CC=golang-codereviews
https://golang.org/cl/136090043
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
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
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
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
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
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
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
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
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
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
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
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.
Fixesgolang/go#7743
LGTM=bgarcia
R=bgarcia
CC=golang-codereviews
https://golang.org/cl/86150043
- 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
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
Special case for (fake) package builtin: don't associate
any constant, variable, or factory function with a type.
Fixesgolang/go#6645.
LGTM=bgarcia
R=bgarcia, r, bradfitz
CC=golang-codereviews
https://golang.org/cl/54820044
Fix output of packages with multiple files.
Remove extra output when filter is requested.
Fixesgolang/go#7115.
R=bradfitz, adg
CC=golang-codereviews
https://golang.org/cl/52750044
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
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
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
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
This allows the creation of URLs to lines of source code with a query
term highlighted without assuming godoc source code URL parameters.
Needed for interfacing with other source code viewing servers.
R=bradfitz
CC=golang-dev
https://golang.org/cl/34200043
Add explicit options to Corpus to control search indexing of documentation, Go source code, and full-text.
R=bradfitz, r
CC=golang-dev
https://golang.org/cl/24190043
On big corpuses, the indexer was spending most of its time waiting
for filesystem operations (especially with network filesystems)
and not actually indexing. This keeps the filesystem busy and indexer
running in different goroutines.
Also, add a hook to let godoc hosts disable indexing of certain
directories.
And finally, start adding tests for godoc, which required
fleshing out (and testing) the mapfs code.
R=golang-dev, adg, bgarcia
CC=golang-dev
https://golang.org/cl/21520045
This lets godoc implementations provide a more efficient means
of getting this information, without reading files and parsing the
package docs.
This is especially important when the files themselves don't
actually exist and the VFS is synthesizing them on demand
(e.g. protocol buffer files -> their generated *.pb.go files).
This means corpus.Init can run quickly, without generating
every protocol file in a large corpus (or fetching it from a
cache).
In the future, this hook could also be used for caching the summaries of
regular packages.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/19440043
Massive win for high-latency network filesystems.
Also benefits the local disk/ssd case too, though.
R=golang-dev, bgarcia
CC=golang-dev
https://golang.org/cl/18650043
Not the right approach.
««« original CL description
go.tools/godoc: reverse reversed redirects
Make godoc work again for go spec and memory model doc.
TBR=rsc
CC=golang-dev
https://golang.org/cl/14368043
»»»
R=gri
CC=golang-dev
https://golang.org/cl/14370043
It was not enough to make /ref/spec work (which it now does),
because some of the docs on golang.org (in particular golang.org/doc)
are pulled from tip, and tip links to /doc/spec now.
Make those "too new" links work by redirecting /doc/spec
back to /ref/spec for now.
TBR=adg
CC=golang-dev
https://golang.org/cl/14348043
Also update style.css to hide outline of editable text areas and apply
correct styles to line numbers in non-playground snippets.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/13946043
Remove References section heading.
Add redirects from old paths to new content.
Add a link to the SubRepositories wiki page from package list.
Add styles for "pop-out" link.
R=r
CC=golang-dev
https://golang.org/cl/13356047
After this change is submitted the dependants on go.talks/pkg/playground
talks will be updated to use this one and the old package will be deleted.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/11759043
Phrases like "returns whether or not the image is opaque" could be
describing what the function does (it always returns, regardless of
the opacity) or what it returns (a boolean indicating the opacity).
Even when the "or not" is missing, the phrasing is bizarre.
Go with "reports whether", which is still clunky but at least makes
it clear we're talking about the return value.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/11458046
The exported Server becomes handlerServer, and part of Presentation
now. Presentation is also now an http.Handler with its own
internal mux (a detail, which might go away).
main.go becomes ever simpler.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11505043
cmd/godoc/godoc.go is now merged into main.go, which is now
only 530 lines.
App Engine mode is still broken, but should be easy to fix up.
(just needs a global *godoc.Presentation created in init)
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/11498044