The directory slice gets created first from newDirTree and then
gets appended again after reading from the dirchs channel. Hence
we need to sort the slice after all the entries are added.
Fixesgolang/go#24601
Change-Id: I9282e8643a4448b2c1c84495b7642610f6c56d50
Reviewed-on: https://go-review.googlesource.com/103955
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Kevin Burke <kev@inburke.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
They exist and are considered to be worth listing based on the decision
made in golang/go#24432. They weren't listed previously. This change
fixes that.
Document the remaining subrepos that are not meant to be listed (per
decision in golang/go#24432), so it's clear that it's intentional for
them to not be visible at https://golang.org/pkg/#subrepo.
Closesgolang/go#24432.
Updates golang/go#14304.
Change-Id: Icc50ebfcdbc490c32519d92a1a838eb3f54c823d
Reviewed-on: https://go-review.googlesource.com/103075
Reviewed-by: Austin Clements <austin@google.com>
Playground needs godoc to support calls to /vet endpoint in playground.js.
Optional parameter "vetEl" is added to the function "playground".
If it's passed then the js installs the click handler to the element.
There is a corresponding CL 100776 for the playground code.
Updates golang/go#7597
Change-Id: Ica2e7cb9d76f6f19a1805c182e666b8142762da9
Reviewed-on: https://go-review.googlesource.com/100775
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Previously we would spin up a new goroutine for every directory
we needed to parse. Since parent directories cannot exit until
children have exited, in large GOPATH directories we could have 8000+
goroutines evaluating directories concurrently. The race detector uses
tsan, and tsan can handle a maximum of 8192 concurrent threads at one
time.
Limit the number of concurrent threads. It is difficult to do this
in a way that does not involve a child being blocked on a parent
completing to spin up goroutines for itself to complete. Solve this by
completing work on the main thread if there are no additional workers
available to help complete work.
I was expecting limiting the concurrency to hurt performance, but it
actually significantly improves it. Benchmarks were performed using CL
94904 at tip, and with goroutines at 2, 4, and 8 times the number of
CPU's.
$ benchstat tip.benchmark gated-2.benchmark gated-4.benchmark gated-8.benchmark
name \ time/op tip.benchmark gated-2.benchmark gated-4.benchmark gated-8.benchmark
NewDirectory-4 293ms ± 2% 262ms ± 4% 252ms ± 4% 253ms ± 2%
name \ alloc/op tip.benchmark gated-2.benchmark gated-4.benchmark gated-8.benchmark
NewDirectory-4 218MB ± 0% 218MB ± 0% 218MB ± 0% 218MB ± 0%
name \ allocs/op tip.benchmark gated-2.benchmark gated-4.benchmark gated-8.benchmark
NewDirectory-4 513k ± 0% 508k ± 0% 509k ± 0% 510k ± 0%
Fixesgolang/go#22110.
Change-Id: If01f78f1fc53cd195e4f8f6988c3c39b3c275992
Reviewed-on: https://go-review.googlesource.com/94955
Reviewed-by: Yury Smolsky <yury@smolsky.by>
Reviewed-by: Kevin Burke <kev@inburke.com>
This flag includes unexported identifiers in command-line mode.
It is equivalent to ?m=all in web mode.
Fixesgolang/go#8093
Change-Id: I1e5a69626929d3430638d900f3e975b272a98c90
Reviewed-on: https://go-review.googlesource.com/99435
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This allows the scripts to be downloaded concurrently as the
body is being parsed.
Deferred scripts are executed in order and only after the entire
document has been loaded. So essentially the entire effect remains same
but we reduce the network download time.
Also, CL 90396 missed out updating static.go. Packaging the change along
with this.
Change-Id: Ia850bd50b49f2a9e0e4fbc29617858ab0fa8a0b9
Reviewed-on: https://go-review.googlesource.com/100295
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
In command-line mode, we were traversing the dir tree with depth
of only 1. This prevented the synopses of sub-directories from being
scanned and showed in the output when a package path was being passed.
Increasing the depth to 2 so that sub-directories of the next
level is also parsed and the synopses gets shown.
Also fixed the comment to reflect that dir can be nil only in
command-line mode now after golang.org/cl/93215
Fixesgolang/go#22646
Change-Id: I066a3bc3ba3d9d3a9589f97137e1bc4497a45473
Reviewed-on: https://go-review.googlesource.com/93675
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This addresses the build errors that caused a
revert of the original PR golang/tools#21Fixesgolang/go#23746
GitHub-Last-Rev: 6606c0b63afb4f1043b2aa2dc640edda4cf9afe8
GitHub-Pull-Request: golang/tools#25
Change-Id: Ic5a7e3054d182dc2041d2966ca68960c3abd7620
Reviewed-on: https://go-review.googlesource.com/96178
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This reverts commit db9df82880.
Reason for revert: Broke the build. I forgot to run tests, sorry.
Change-Id: I8a6ef88cac2aa638982530960f0d37a32dc5ccf0
Reviewed-on: https://go-review.googlesource.com/95875
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
We used a css-pseudo class rule to move the line number inside
the pseudo element. The idea was to prevent line numbers from getting
selected while copying the code. But this was already implemented
with the "user-select: none" rule.
Since the spec was undefined on "user-select", we had to resort
to the pseudo-class, but now both FF and Chrome implement the correct
behavior.
Hence, moving the content to be inside the span, and removing the
pseudo-class rule.
Manually tested with Chrome 63 and Firefox 58 on Ubuntu.
Fixesgolang/go#23724
Change-Id: I3e733db766b44875ba6bc3f6985cde2559d116e2
Reviewed-on: https://go-review.googlesource.com/93975
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
The example_html was being rendered outside the ".expanded" div which
did not hide it when the parent Overview div was being hidden. Moving it
inside the div so that the behavior is consistent
Fixesgolang/go#23590
Change-Id: I75ee0af1c4074e02629b84ce366b34711e6d823b
Reviewed-on: https://go-review.googlesource.com/90396
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Currently, in http mode the server blocks until the corpus
has been initialized. This can cause considerable delay
if the user workspace is significantly large and the files
are not present in the buffer cache.
This CL spawns off the initialization in a separate goroutine
if httpMode is set and turns on a flag when it's done.
The http handler checks the flag and returns an error response
if it has not been set.
The check is only performed for the path prefixes handled by the
handlerServer struct. Other paths do not call the GetPageInfo() function
and hence can return immediately. This preserves maximum responsiveness
of the server.
Also adds an additional print statement in verbose mode
Note: This is a re-do of a previous CL golang.org/cl/88695 which was
incorrect committed without running tests. This CL fixes that test.
Fixesgolang/go#13278
Change-Id: I80c801f32af007312090d3783a2ea2c6f92cad66
Reviewed-on: https://go-review.googlesource.com/93215
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Currently, in http mode the server blocks until the corpus
has been initialized. This can cause considerable delay
if the user workspace is significantly large and the files
are not present in the buffer cache.
This CL spawns off the initialization in a separate goroutine
if httpMode is set and turns on a flag when it's done.
The http handler checks the flag and returns an error response
if it has not been set.
The check is only performed for the path prefixes handled by the
handlerServer struct. Other paths do not call the GetPageInfo() function
and hence can return immediately. This preserves maximum responsiveness
of the server.
Also adds an additional print statement in verbose mode
Fixesgolang/go#13278
Change-Id: I0505acc1c190423d09fb199b11ca86e0400e84d4
Reviewed-on: https://go-review.googlesource.com/88695
Reviewed-by: Andrew Bonventre <andybons@golang.org>
When sending the request to /share, it defaulted to
application/x-www-form-urlencoded. This caused the body to be
empty since it was sending a form with the actual code as a
key in the r.Form map.
Set the content type explicitly to text/plain.
Fixesgolang/go#21691
Change-Id: I0d5981d9c9aa901010af65b0d0a7670870b77f2b
Reviewed-on: https://go-review.googlesource.com/86317
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Now that play.golang.org and sandbox[-flex].golang.org have been
merged, proxy requests to the former.
Change-Id: I7d18d0494fd54c2357dc53952fa458ceb1380aca
Reviewed-on: https://go-review.googlesource.com/86253
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Some default browser stylesheets set a border radius on <button>
elements that was not being overridden in style.css. The button
should not have any border radii on the left as it should look
like an extension of the search field.
Change-Id: I458bd2e3a903a4c1dd246ff0304e7d3cf29c0988
Reviewed-on: https://go-review.googlesource.com/83296
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
That's what our main XP developer has, and what our builder is.
We can't vouch for anything older. Also, IIRC, there were some
TLS/cert changes in SP3 we depended on, but I can't find the details
in quick searches.
Change-Id: I876494b2c8d201e2d1a8a74ffc6150697208af6f
Reviewed-on: https://go-review.googlesource.com/83096
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
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: I4ea360efddd28a9a1236d5adfdafb1a0970a4215
Reviewed-on: https://go-review.googlesource.com/58890
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
There were two issues with links in godoc:
1) They were only distinguished from ordinary text only by color,
affecting those with color-vision deficiencies.
2) The same blue used for links is used by non-links,
affecting everybody.
This change adds a an underline to all links.
Usually, it is safe to skip underlining in locations where it clear
that the only contents are navigational links, such as #pkg-index.
However, (2) prevented this.
To work around this I used some less well supported CSS techniques:
http://caniuse.com/#feat=text-decoration
Less capable browsers, which are unlikely to be used by developers, may
have a less than optimal experience, unfortunately. In more capable
browsers, including those without full support, the experience is quite
pleasant and the additional underlying does not interfere with the godoc
aesthetic.
For golang/go#22171
Change-Id: I5a0d817793e8aa31912ba065b4e5a63d4a3f138c
Reviewed-on: https://go-review.googlesource.com/69150
Reviewed-by: Andrew Bonventre <andybons@golang.org>
To increase accessibility of the search bar,
an aria-label for screen readers and a submit
button was added.
The search field was given the semantically correct
input type and marked required field as hints to UAs
that can use that to provide context to the user.
The placeholder text was restyled for improved contrast.
The javascript for handling placeholders was removed
as it is no longer necessary.
For golang/go#22171
Change-Id: I8db6428bb727a09e7f175e77100b4bcf9b6a5f3e
Reviewed-on: https://go-review.googlesource.com/69190
Reviewed-by: Andrew Bonventre <andybons@golang.org>
This CL makes permalinks accessible to keyboard-users and screen
readers.
Adding an aria-label to permalinks overrides the default content
of "pilcrow".
As the permalinks only showed on hover they were inaccessible
to users who could only use a keyboard and are now always shown.
For golang/go#22171
Change-Id: I6ce3828dfedfd7edc29dd16f3eb94a0abcabfc7c
Reviewed-on: https://go-review.googlesource.com/69210
Reviewed-by: Andrew Bonventre <andybons@golang.org>
The heading of the #pkg-index section of package documentation pages
uses an h2 heading but its 'Examples' and 'Package files' subsections
use h4 headings, skipping the h3 level.
This change switches the h4s to h3s and adds styling to preserve the
current font-size with the new heading level.
For golang/go#22171
Change-Id: Ifd2cacab22c1e82fd6f061b9322523fa5859a80f
Reviewed-on: https://go-review.googlesource.com/69171
Reviewed-by: jimmy frasche <soapboxcicero@gmail.com>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
The gopher with a miner hat on /pkg had no alt attribute
so screen readers would announce the image by its filename.
As the image is purely decorative, adding the empty string
as alternative text prevents the image from being announced.
For golang/go#22171
Change-Id: Ib214f296d3d9f9084c44d4e33d1cbe432f2183ed
Reviewed-on: https://go-review.googlesource.com/69130
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This increases reliability and performance of downloads
across locales.
Change-Id: I619f986496dea57e1ee5e8150e31b2a6f8d8dde7
Reviewed-on: https://go-review.googlesource.com/60090
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Revert https://golang.org/cl/45096.
Original change description:
godoc: follow symbolic links to folders in GOROOT
Directory walking in godoc relies on ReadDir which returns the result
of os.Lstat.
Instead make the the OS VFS's ReadDir use os.Stat on symlinks before
returning.
Updates golang/go#15049Fixesgolang/go#21061
Change-Id: Ieaa7923d85842f3da5696a7f46134d16407dae66
Reviewed-on: https://go-review.googlesource.com/53634
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Use that property to determine whether to show share functionality
or link to sites that are blocked in mainland China.
This change requires https://go-review.googlesource.com/c/52872
Change-Id: I47327f9dbd2624206564fa99eb1cc6a10b4f46db
Reviewed-on: https://go-review.googlesource.com/52873
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Redirects to /r/NNNN broke due to crbug.com/gerrit/6888.
Alternative URLs are available in the meantime: /NNNN and /c/NNNN.
This change uses the /NNNN format.
Fixesgolang/go#21235
Change-Id: Ie30e01bedd7a8277aedd4070b5f82a754521ed03
Reviewed-on: https://go-review.googlesource.com/52150
Reviewed-by: Kevin Burke <kev@inburke.com>
Directory walking in godoc relies on ReadDir which returns the result
of os.Lstat.
Instead make the the OS VFS's ReadDir use os.Stat on symlinks before
returning.
Fixesgolang/go#15049
Change-Id: I34d17ca0027b0245f5ef434a000e5a3fe2af11cf
Reviewed-on: https://go-review.googlesource.com/45096
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>