In the go/doc, the same map as "predeclared" is defined.
Instead of the "predeclared" map use the "IsPredeclared" function
which is an accessor for the go/doc map.
Deleted unnecessary "predeclared".
Fixesgolang/go#20357
Change-Id: I7fdf42cfeb4440fb490be9380f39035be88f9a5a
Reviewed-on: https://go-review.googlesource.com/43473
Reviewed-by: Kevin Burke <kev@inburke.com>
The link of the function declaration part is unnecessary because it points to the same place.
Removed the link of the function declaration part.
"IdentMode" has been removed since it is no longer used.
Fixesgolang/go#20269
Change-Id: I6399899947e46dc84c5432c1d645f6d96b7db4f6
Reviewed-on: https://go-review.googlesource.com/42892
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Insert line numbers via a ::before pseudo-element so you can't select
them when you copy text. See the code comment for more information.
Fixesgolang/go#20077.
Change-Id: I24a5b17786a52c8107b4f830e824526ba03bc38d
Reviewed-on: https://go-review.googlesource.com/41418
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
godoc once again adds anchors for variable and constant
declarations. Individual declarations and lists of declarations are
both covered.
Fixesgolang/go#19894
Change-Id: If5f8f0c3429774f33535e2e654685ba5d71937f1
Reviewed-on: https://go-review.googlesource.com/40300
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This allows URLs like golang.org/wiki/DevExp/, where before only
golang.org/wiki/DevExp was accepted.
Fixesgolang/go#19432.
Change-Id: Ie41a4fe1d1930fd947c1d0523060d08c7c6d6d39
Reviewed-on: https://go-review.googlesource.com/37882
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
Prior to this change, handlerServer.GetPageInfo created a build.Context
starting with build.Default, and provided custom implementations for
its IsAbsPath, ReadDir, and OpenFile funcs. Those funcs would operate
on h.c.fs virtual filesystem.
https://godoc.org/go/build#Context.IsDir is documented as:
// IsDir reports whether the path names a directory.
// If IsDir is nil, Import calls os.Stat and uses the result's IsDir method.
IsDir func(path string) bool
IsDir was left as nil, and so the default implementation was used.
The default implementation uses os.Stat and isn't aware of the h.c.fs
virtual filesystem.
This appears to have been harmless in the past, but after the change to
go/build in https://golang.org/cl/33158, it started to interfere with
the operation of godoc. The command godoc began to fail to resolve
relative import path "." in directories that exist, because the
incorrect IsDir implementation was looking in real filesystem, rather
than the virtual one:
$ ./godoc fmt
2017/03/04 18:59:50 cannot find package "." in:
/target
$ ./godoc -http=localhost:6060
2017/03/04 19:00:07 cannot find package "." in:
/src/fmt
Providing a custom implementation of IsDir that is aware of the h.c.fs
virtual filesystem, and performs a stat operation on the correct path
there resolves that problem. It also fixes the failing tests.
Additionally, because the exact error string returned from
Context.Import has changed after https://golang.org/cl/33158,
and now contains the text "package not found" rather than the
underlying error text from filesystem caused by a failed ReadDir
operation, the expected error message from "./godoc nonexistingpkg"
in a test needed to be updated to "cannot find package". It's no longer
dependent on the operating system.
It might be desirable to provide more relevant detail in the error
message from cmd/godoc when a package is not found, but that should be
determined and done in a followup CL. The scope of this one is to fix
normal functionality.
This change follows update to go/build in https://golang.org/cl/33158.
Helps golang/go#19401.
Change-Id: I00e2f746ec4a2fe7e640218adce75f15bdf29aaf
Reviewed-on: https://go-review.googlesource.com/37768
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Found with honnef.co/go/tools/cmd/unused.
Change-Id: I193ddd265673f133a489d268629b94be693a8dbc
Reviewed-on: https://go-review.googlesource.com/37606
Reviewed-by: Alan Donovan <adonovan@google.com>
Previously, field names in composite literals were treated as normal
identifiers. For example, in Foo{X: 42}, X was treated link a normal
variable and was linked to "#X".
With this change, field links now include a prefix for their type
definition, for example, "#Foo.X".
Fixesgolang/go#16031
Change-Id: I9cb501704f284fbbc05424555312307c61843e47
Reviewed-on: https://go-review.googlesource.com/36830
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
godoc formats function examples for text or HTML output by
stripping the surrounding braces and un-indenting by replacing
"\n " with "\n". This modifies the content of string literals,
resulting in misleading examples.
This change introduces a function, replaceLeadingIndentation, which
unindents more carefully. It removes the first level of indentation
only outside of string literals. For plain text output, it adds custom
indentation at the beginning of every line including string literals.
Fixesgolang/go#18446
Change-Id: I52a7f5756bdb69c8a66f031452dd35eab947ec1f
Reviewed-on: https://go-review.googlesource.com/36544
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
Right now, clicking around packages in the godoc web interface strips
the URL of any query strings it may have, which makes traversing
internal packages a clumsy experience (constantly have to re-add ?m=...).
This revision preserves the ?m=... flag in links between packages by examining
the current PageInfoMode and converting it to a query string.
Change-Id: I4e28279d8cbf221bcc7d5bce8de04c90cc907678
Reviewed-on: https://go-review.googlesource.com/34982
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Details:
- remove go1.5 "default version" labels on most files
- remove go1.6 labels on a few files
- go/loader: use conf.Cwd not "." in a couple places; update faulty
test expectations. (Not sure why this wasn't caught sooner.)
- go/ssa/interp: add 'mono' result to time.now intrinsic
- go/gcimporter15/bimport.go: make consistent with the version in gc
- go/ssa/interp: update test error message
- go/ssa: update a comment
The go/gcimporter15/bexport.go logic is stale and needs to be brought
up to date. Needs a separate CL since it's tricky.
Tested on go1.6, go1.7, go1.8.
Change-Id: I841189d30e131b7c49a4e8690ea7c40b55041bae
Reviewed-on: https://go-review.googlesource.com/36540
Reviewed-by: Robert Griesemer <gri@golang.org>
If enabled (via the "enableShortcuts" option), Ctrl+S/Cmd+S now
saves/shares the playground snippet and initiates a download.
Credit to Alexander Kucherenko (see golang.org/cl/35950).
Updates golang/go#15378.
Change-Id: I8a2d733c25e4c95787fbe1f5ac00fa1befbb4693
Reviewed-on: https://go-review.googlesource.com/36486
Reviewed-by: Andrew Gerrand <adg@golang.org>
Fixes two problems with adding the #StructType.FieldName anchors for
linkified struct fields:
* the old code was quadratic
* the old code only dealt with ASCII only
Change-Id: If03a367a94d05d3d470e1326dfb573037088ff78
Reviewed-on: https://go-review.googlesource.com/35486
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Currently both "testUnix" and "testWindows" elements are shown simultaneously.
This change detects the correct platform to hide/show the appropriate
elements based on the viewer's browser.
Change-Id: I3afee7507d61b2d756127166caede85adcd531b8
Reviewed-on: https://go-review.googlesource.com/35103
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Explain how to make changes to the project's static files and get them compiled
in to the godoc binary.
Change-Id: I12e0c50bf31925b3f211b6d0dd3e5f8cff547f32
Reviewed-on: https://go-review.googlesource.com/34925
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Previously a selection of text that spanned multiple lines would
include the line number as part of the orange highlight. This is
misleading (the line numbers aren't copied when you highlight the
text with your mouse) and a little ugly.
I had to move the tab character inside the <span class="ln"> block,
otherwise the orange highlight goes right up to the number, which is
off-putting and means the orange highlights don't line up vertically.
Before: https://monosnap.com/file/F9L166Zxxnf3ev74Z3JoJT0xz0nYLn.png
After: https://monosnap.com/file/6jfeFBG6tzhy3ZErqYWn6BfZ4fyk1R.pngFixesgolang/go#18561
Change-Id: I312d30ce01071850f8724246c54ce2d7259619d2
Reviewed-on: https://go-review.googlesource.com/34924
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This change makes each release show only once on the whole page.
The current stable releases are not shown under the archive.
This change also fixes expandos to work correctly on IDs that are not
valid CSS selectors (i.e., "#go1.7.4") to ensure that the file listing
for a given version is expanded.
Updates golang/go#17574.
Change-Id: I7ff1041be3e0072286772ffa545a124764f81945
Reviewed-on: https://go-review.googlesource.com/34911
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Under "Stable Versions", only show the latest minor versions of the most two
recent major versions.
Under each of those versions, move the downloads for primary ports to
the top of the table and the other downloads under a separate
"Other Ports" heading.
Add a listing for every stable Go version under "All versions",
collapsed by default.
Fixesgolang/go#17574.
Updates golang/go#17018.
Change-Id: I7d74fef1b44a319a4bf65dedf24ffb27a7009f60
Reviewed-on: https://go-review.googlesource.com/34824
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Toggles can now be nested within one another. They can also be
referenced using an <a> element with the name attribute, rather than
an element with the "id" attribute.
Updates golang/go#17574.
Change-Id: I43c17499a6879e983a79a74e14c99128296288e1
Reviewed-on: https://go-review.googlesource.com/34825
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Specifically restricted to the "article" class, which is only used on
the blog.
Fixesgolang/go#18302.
Change-Id: I5988c3df70f0de93d77544edf091640b0c5df30c
Reviewed-on: https://go-review.googlesource.com/34828
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Adds instructions for "go get golang.org/x/build/version/..."
for the unstable version.
Fixesgolang/go#18337.
Change-Id: Iea5e8fab7f00a053e3b42ef355277307addb635b
Reviewed-on: https://go-review.googlesource.com/34823
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This partially reverts https://go-review.googlesource.com/#/c/33279/
(which moved doc strings above the declaration for all kinds of objects)
by moving the doc string for functions and methods below the signature
where they traditionally were.
Fixesgolang/go#18150.
Change-Id: Icbb9e7edcb3b34ad1d900acb3180217abdc56a16
Reviewed-on: https://go-review.googlesource.com/34332
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Picks up changes made in previous commits.
Change-Id: I8edc9e0a512e4d687c471274faaa06e0b40ea657
Reviewed-on: https://go-review.googlesource.com/34283
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Now without regexps and allocations.
And also match comments like:
// Foo, if non-nil, ...
The comma confused the old pattern.
Updates golang/go#16753
Change-Id: I9016ee7b5933ea343950a39989952804c74a598b
Reviewed-on: https://go-review.googlesource.com/33755
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
This adds <span id="StructName.FieldName"> elements around
field names, starting at the comment if present, so people
can link to /pkg/somepkg/#SomeStruct.SomeField.
Fixesgolang/go#16753
Change-Id: I4a8b30605d18e9e33e3d42f273a95067ac491438
Reviewed-on: https://go-review.googlesource.com/33690
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
We already have anchors for godoc types and functions. Add them for
every heading (and "dl") on every other page on the site.
Change-Id: Ibad77f04442e48dd5a41de759010625f89b48604
Reviewed-on: https://go-review.googlesource.com/33641
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The existing implementation shows a comment after its code block.
This causes confusion regarding how the comment relates to a code block.
Comments have been moved before their relative code blocks.
Fixesgolang/go#16728
Change-Id: Ie07a6dd2f340a2555513662f263d26377060f93b
Reviewed-on: https://go-review.googlesource.com/33279
Reviewed-by: Alan Donovan <adonovan@google.com>
The SHA sums are clearly visible (and copy-pastable) in the expanded section
immediately below it.
Fixesgolang/go#16900.
Change-Id: If1805534b3893f6c38f4170c4b457ff0e935ce28
Reviewed-on: https://go-review.googlesource.com/33290
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This CL only copies files and updates build tags.
Substantive changes will come in follow-ups.
This is a workaround for git's lack of rename/copy tracking.
Tested with go1.6, go1.7, and tip (go1.8).
Change-Id: Id88a05273fb963586b228d5e5dfacab32133a960
Reviewed-on: https://go-review.googlesource.com/32630
Reviewed-by: Robert Griesemer <gri@golang.org>
Supporting user-defined TestMain functions requires that we generate a
"testmain" package for each testable package, rather than a single one
for the entire program. This entails these API changes:
1. (*ssa.Program).{CreateTestMainPackage,FindTests} both now
accept only a single package. Existing clients that pass them
multiple packages must call them from a loop.
2. (*ssa.Program).FindTests returns an additional result, the the
optional TestMain *ssa.Function. Existing clients may discard it.
Also:
- Test the new logic using the SSA interpreter
- add ssautil.MainPackages helper
- callgraph: allow multiple main packages, and analyze them all
- ssadump -run: allow multiple main/test packages, and run each in a new interpreter
- minor simplifications to some callers (e.g. guru)
Fixesgolang/go#9553
Change-Id: Ia7de9bd27448fb08b8d172ba5cdbcf37a762b7a0
Reviewed-on: https://go-review.googlesource.com/25102
Reviewed-by: Robert Griesemer <gri@golang.org>
Exposing the full paths to files is considered possible
source of vulnerabilities.
Change-Id: Ie9ae3791e51fcff5f1df711f84db9879d7e6ce37
Reviewed-on: https://go-review.googlesource.com/29445
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This prevents a JS error when the notes are not present.
Change-Id: Ib8875306027b7e43441310d4228c690e2249056e
Reviewed-on: https://go-review.googlesource.com/24963
Reviewed-by: Andrew Gerrand <adg@golang.org>
When building the corpus of local packages, a "too many open files"
error would cause some directories inside GOPATH to be skipped.
Further, the error would not be reported because it was masked by a
"file not found" error from the GOROOT VFS layer.
This change adds a rate limit around parsing files when buildling
the directory tree, error reporting when godoc is run with -v, and
fixes the masked error issue in the vfs package.
It's possible that the rate limiting could be put into the
godoc/vfs/gatefs package, but I tried making the gate account for
open files (not just individual open/close/read/write operations)
but then godoc just hard locks (it wasn't designed to only open 20
files at once).
Change-Id: I925d120b53d9a86430b6977cb90eb143785ecc48
Reviewed-on: https://go-review.googlesource.com/24060
Reviewed-by: Dave Day <djd@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Added anchor link beside each function, type and method definition in
godoc's generated HTML. Anchor links are only shown when the mouse is
hovering over the definition. The link body is the Unicode PILCROW SIGN
character (¶ HTML entity).
Fixes: golang/go#13748
Change-Id: I645269f6c229f76b2882899e1a7483577877ac30
Reviewed-on: https://go-review.googlesource.com/20246
Reviewed-by: Andrew Gerrand <adg@golang.org>
A pared down verison of https://golang.org/cl/20458
that is compatible with Go 1.5.
Fixesgolang/go#10149
Change-Id: I550b097dc1cd65d0711bdea943f2b0678cfbc5fd
Reviewed-on: https://go-review.googlesource.com/22032
Reviewed-by: Caleb Spare <cespare@gmail.com>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
This will allow the source installation instructions to
always show the current version, but only when that version
is a release version.
Fixesgolang/go#14371
Change-Id: Ibfad8054f3c75d9320ca94ba5149ab9bf052157e
Reviewed-on: https://go-review.googlesource.com/22056
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This fixes some print calls with wrong format directives. Additionally,
struct initialisers were changed to use keyed fields, purely to reduce
the amount of noise generated by go vet.
Change-Id: Ib9f6fd8f2dff7ce84826478de0ba83dda9746270
Reviewed-on: https://go-review.googlesource.com/21180
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The existing implementation of NameSpace implicitly assumes that a
FileSystem with a directory at the top will be mounted at the root
mount point "/" of the NameSpace. If this is not the case, then
Stat("/") will fail even if ReadDir("/") succeedes. This is unexpected
behavior which breaks directory traversal routines (eg. http.FileServer).
This CL adds an unexported implementation of FileSystem called emptyVFS
that emulates an empty directory and adds a NewNameSpace() function that
binds emptyVFS to "/" so that unexpected behavior does not arise even if
the use does not mount anything explicitly at "/".
Latest patch set causes the FileInfo of the empty top level emulated
directory to return "/" for Name() and Zero Time for ModTime() and
removes the related struct state fields being used in the previous
implementation.
Fixesgolang/go#14190
Change-Id: Idce2fc3c9b81206847a33840d76b660059d53d18
Reviewed-on: https://go-review.googlesource.com/19445
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
When an Example's output is listed as being Unordered this will make
godoc display "Unordered output:" rather than the normal "Output:".
For an example of where this is useful, see the recently added example
for math.rand.Perm().
Change-Id: I737c901102dca46434f46a48300445bb43ce34e0
Reviewed-on: https://go-review.googlesource.com/20458
Reviewed-by: Andrew Gerrand <adg@golang.org>
When a file is not found, it's common to return an error that can
be detected with os.IsNotExist helper. It's possible to use
os.PathError type to satisfy that requirement while still providing
the path information in the error.
Add a test that files that are not found return a non-nil error, and
that the error satisfies os.IsNotFound.
Change-Id: I5f1a26b18f2556af822ede73306541e8575ede28
Reviewed-on: https://go-review.googlesource.com/19503
Reviewed-by: Andrew Gerrand <adg@golang.org>
This is safe because the page title is HTML-escaped as it is displayed.
Fixesgolang/go#14208
Change-Id: Ib98071a08adeaad79043b9a2eb07bc7a5e8d251d
Reviewed-on: https://go-review.googlesource.com/19242
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This allows users to change the GOOS/GOARCH without running their own
godoc server (or restarting with appropriate env vars).
Change-Id: I0b54ef1b2dd93cf2c965ca584d8df74119ed1be6
Reviewed-on: https://go-review.googlesource.com/1371
Reviewed-by: Andrew Gerrand <adg@golang.org>
Such packages may be viewed by adding ?m=all to the URL.
Fixesgolang/go#13929
Change-Id: Id0ac48bc2937b5bec722b95b9a690d48d065ea6b
Reviewed-on: https://go-review.googlesource.com/18554
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
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