To trim a string prefix from the names when generating their final
strings. Add a simple test too.
There is no automatic detection of prefixes for now. That can be added
later, building on top of this first simple implementation.
Fixes#16539.
Change-Id: Ica37273ac74bb0a6cbd43e61823786963d86a492
Reviewed-on: https://go-review.googlesource.com/76650
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
CL https://golang.org/cl/66130 changes go/printer to format one-method
interfaces to be printed on a single line. This change broke the
equality check in TestRewrites. Fix it by reformatting the expected
file buffers so that the tests pass with tip and previous Go versions.
Change-Id: I660efd81b362554db0515760dad7c8b62e4db1b3
Reviewed-on: https://go-review.googlesource.com/75812
Reviewed-by: Alan Donovan <adonovan@google.com>
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>
When toolstash -cmp found diff, it does a second compilation
with extra flags -v -m=2, which are imcompatible with the
concurrent backend. Pass -c=1 in the second compilation.
Change-Id: I3c77069936da1829b68375a4a6c7f9bbe364247c
Reviewed-on: https://go-review.googlesource.com/60390
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
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>
Manually apply same change as CL 68110 did for cmd/go/internal/get,
but for golang.org/x/tools/go/vcs, to help keep them in sync.
Updates golang/go#22125.
Helps golang/go#11490.
Change-Id: I255f7a494d9572389fc8dc8ce96891b6fcc214a0
Reviewed-on: https://go-review.googlesource.com/68352
Reviewed-by: Russ Cox <rsc@golang.org>
Move the README to README.md so Gerrit can render it; currently
Gerrit only renders files named exactly "README.md" (for example at
https://go.googlesource.com/go).
Add more links to the README explaining how to file issues,
how to submit code changes, where to download the code to and
how to get it. Hopefully this should help people who go to
https://go.googlesource.com/tools or https://github.com/golang/tools
figure out how to get started with development.
Change-Id: I778202d9759df5cf79e86b8524046e108aa3db3d
Reviewed-on: https://go-review.googlesource.com/49852
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
There was an extra line in the documentation for the
present package that appears to be a copy paste from the
previous paragraph. This removes that line.
Fixes#21891
Change-Id: Ic50840b2210e3d93ac452a659e29b6feaa33c7b7
Reviewed-on: https://go-review.googlesource.com/63811
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>
The following tag
// +build linux,!appengine darwin
Translated to (linux AND !appengine) OR (darwin)
Causing issues on darwin when attempting to run dev_appserver.
Change this to always exclude these files from appengine builds.
Change-Id: Ifd63a884747001797d0b0e828f0c9c391bc7c73c
Reviewed-on: https://go-review.googlesource.com/60911
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
On mobile and tablets, it was very difficult to view slides because the
slides were not designed to be smaller than 1250x750.
This adds a function to the JS that uses CSS scaling to make the slides
fit on smaller displays.
Fixesgolang/go#21643
Change-Id: I68e9e2c1274aaf6396bf01d19ca023cddf76e2ec
Reviewed-on: https://go-review.googlesource.com/60270
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Francesc Campoy Flores <campoy@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Francesc Campoy Flores <campoy@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The root block was used as a sentinel. This means we always need to
allocate a second block on the heap, even if the set has a few small
elements.
We now use the root block: it is always the block with the smallest
offset. The logic becomes very messy if there is no sentinel; to avoid
this we still use a sentinel (a special singleton block) and return it
in when appropriate in the first, last, next wrappers.
Also adding some benchmarks and making some optimizations:
name old time/op new time/op delta
Popcount-4 2.18ns ± 1% 2.21ns ± 1% +1.47%
InsertProbeSparse_2_10-4 76.2ns ±23% 37.2ns ± 1% -51.21%
InsertProbeSparse_10_10-4 240ns ±15% 162ns ± 4% -32.58%
InsertProbeSparse_10_1000-4 419ns ± 4% 371ns ±19% -11.43%
InsertProbeSparse_100_100-4 2.30µs ± 1% 1.93µs ± 1% -16.08%
InsertProbeSparse_100_10000-4 2.12µs ± 3% 2.07µs ± 1% -2.11%
UnionDifferenceSparse-4 165µs ±16% 170µs ± 9% ~
UnionDifferenceHashTable-4 310µs ±10% 291µs ±17% ~
AppendTo-4 11.0µs ± 0% 11.0µs ± 0% -0.35%
name old alloc/op new alloc/op delta
Popcount-4 0.00B ±NaN% 0.00B ±NaN% ~
InsertProbeSparse_2_10-4 64.0B ± 0% 0.0B ±NaN% -100.00%
InsertProbeSparse_10_10-4 64.0B ± 0% 0.0B ±NaN% -100.00%
InsertProbeSparse_10_1000-4 256B ± 0% 192B ± 0% -25.00%
InsertProbeSparse_100_100-4 64.0B ± 0% 0.0B ±NaN% -100.00%
InsertProbeSparse_100_10000-4 256B ± 0% 192B ± 0% -25.00%
UnionDifferenceSparse-4 59.4kB ± 0% 59.2kB ± 0% -0.32%
UnionDifferenceHashTable-4 138kB ± 0% 138kB ± 0% ~
AppendTo-4 0.00B ±NaN% 0.00B ±NaN% ~
name old allocs/op new allocs/op delta
Popcount-4 0.00 ±NaN% 0.00 ±NaN% ~
InsertProbeSparse_2_10-4 1.00 ± 0% 0.00 ±NaN% -100.00%
InsertProbeSparse_10_10-4 1.00 ± 0% 0.00 ±NaN% -100.00%
InsertProbeSparse_10_1000-4 4.00 ± 0% 3.00 ± 0% -25.00%
InsertProbeSparse_100_100-4 1.00 ± 0% 0.00 ±NaN% -100.00%
InsertProbeSparse_100_10000-4 4.00 ± 0% 3.00 ± 0% -25.00%
UnionDifferenceSparse-4 928 ± 0% 925 ± 0% -0.32%
UnionDifferenceHashTable-4 271 ± 0% 271 ± 0% ~
AppendTo-4 0.00 ±NaN% 0.00 ±NaN% ~
Fixesgolang/go#21311.
Change-Id: Ie472a2afa269c21cb33b22ffdac8dd2594b816ac
Reviewed-on: https://go-review.googlesource.com/53431
Reviewed-by: Alan Donovan <adonovan@google.com>
Before this change, astutil would only do a prefix match of a new import
with all the existing ones, to try to place it in the correct group. If
none was found, the new import would be placed at the beginning of the
first import group.
This works well for new std imports, but it doesn't work well for new
third-party packages that don't share any prefix with any of the
existing imports.
Example:
import (
"time"
"github.com/golang/snappy"
)
When adding "golang.org/x/sys/unix" with astutil.AddImport, the import
is inserted as follows:
import (
"golang.org/x/sys/unix"
"time"
"github.com/golang/snappy"
)
And goimports reorganizes the imports to separate std and third-party
packages:
import (
"time"
"golang.org/x/sys/unix"
"github.com/golang/snappy"
)
We usually don't want to introduce a new import group; in most cases,
the desired behavior is separating std from third-party packages.
With this CL, new imports that don't share prefix with any existing ones
will be placed with the first group of third-party imports, if any
exist. If no third-party import group exists, a new one will be added.
In the case of our example above, this will be the new outcome:
import (
"time"
"github.com/golang/snappy"
"golang.org/x/sys/unix"
)
Fixesgolang/go#19190.
Change-Id: Id4630015c029bd815234a6c8726cb97f4af16f1c
Reviewed-on: https://go-review.googlesource.com/37552
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Caller is *ssa.Function. Its Pkg field is *ssa.Package. But ssa.Package
struct doesn't contain either field or method named Object.
So one gets the following error:
$ callgraph -format '{{.Caller.Pkg.Object.Path}} -> {{.Callee.Pkg.Object.Path}}' \
$(go env GOROOT)/src/net/http/triv.go | sort | uniq
callgraph: template: -format:1:9: executing "-format" at <.Caller.Pkg.Object.P...>: can't evaluate field Object in type *ssa.Package
ssa.Package contains Pkg field:
Pkg *types.Package // the corresponding go/types.Package
types.Package contains Path() method that returns the package path.
That appears to be the right way to get the "import path of the
enclosing package" with the current x/tools/go/ssa API.
Fixesgolang/go#20459.
Change-Id: I3cb7b61b767148f5c771d57f8f5e7e6ab20aea87
Reviewed-on: https://go-review.googlesource.com/43812
Reviewed-by: Avelino <t@avelino.xxx>
Reviewed-by: Alan Donovan <adonovan@google.com>
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>
The import path is ambiguous in the presence of vendoring (e.g. golang/go#20610)
Change-Id: I22f372b233b8554e3d9210b383a7df7a6a0f3eee
Reviewed-on: https://go-review.googlesource.com/53470
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>
https://golang.org/cl/52390 was submitted too early with failing trybots.
This fixes it, hiding the cloud.google.com stuff behind a build tag,
used by the Dockerfile but not the Go build system.
Change-Id: I66c6b40d4b06bf6c763f3ab221c7997856bfc910
Reviewed-on: https://go-review.googlesource.com/52470
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jessie Frazelle <me@jessfraz.com>
Fixes expired cert issue too, either by virtue of newer autocert, or
that we're no longer hitting some LetsEncrypt rate limit.
But we have a cache now at least, so we should be nicer to LetsEncrypt
when the process dies. I did see some process crashes (old?) in the
logs. So maybe we were crashing and re-hitting LE often.
Verified that the cert now expires:
Sunday, October 29, 2017 at 9:57:00 PM Pacific
and that it's cached in GCS.
Fixesgolang/go#21251
Change-Id: I3def551ae8eef5df0ec7c51927c4d4bb52cd7a6a
Reviewed-on: https://go-review.googlesource.com/52390
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Jessie Frazelle <me@jessfraz.com>
Run-TryBot: Jessie Frazelle <me@jessfraz.com>
There is nothing else we can do other than just showing a
message that user need to remove it from their PATH not
to conflict with the current installation.
Fixes#21217.
Change-Id: Ie65385f4d536d5bb789387ba0229f54f2ee793f0
Reviewed-on: https://go-review.googlesource.com/51930
Run-TryBot: Jaana Burcu Dogan <jbd@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Kevin Burke <kev@inburke.com>
A couple fixes:
* Disable integration tests in short mode.
* Remove import of "google.golang.org/appengine" package. App Engine has
two ways to create an app: as a main package and calling
appengine.Main(), and as any regular Go package with handlers registered
in init().
Change-Id: Ib416111786c1c86cf428d91c60dc406c251d3ca1
Reviewed-on: https://go-review.googlesource.com/52211
Run-TryBot: Chris Broadfoot <cbro@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
Currently, we output:
The latest go version is go1.8.3, install that? Y/n [Y]: Y
Download go version go1.8.3 to /Users/jbd/.go? Y/n [Y]: Y
Change-Id: I4fa72f2066259b75d3349487dae5bdced9fdd8a2
Reviewed-on: https://go-review.googlesource.com/51910
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>
Initial commit of getgo, a "one-line installer".
Example use from bash:
curl -LO https://get.golang.org/$(uname)/go_installer && chmod +x go_installer && ./go_installer && rm go_installer
It's comprised of two parts:
cmd/getgo/server: an App Engine application that redirects users to an
appropriate installer based on the request path, which identifies the
user's operating system. It's deployed to get.golang.org.
cmd/getgo: a cross-compiled binary that does the heavy lifting of
downloading and installing the latest Go version (including setting up
the environment) to the user's system. The installers are served from
the golang GCS bucket.
Currently supported systems:
linux, darwin, windows / amd64, 386
Authored by Jess Frazelle, Steve Francia, Chris Broadfoot.
Change-Id: I615de86e198d3bd93e418fa23055d00ddbdd99fb
Reviewed-on: https://go-review.googlesource.com/51115
Reviewed-by: Jaana Burcu Dogan <jbd@google.com>
Fixesgolang/go#21055.
Change-Id: I126cef4496c15424048e39b2af111c95580b90fb
Reviewed-on: https://go-review.googlesource.com/49390
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
During the first run of `go-contrib-init` it tries to install the
golang.org/x/review/git-codereview package using `go get`. If this command were
to fail, we would check for the error and log that the command failed to
succeed. However, when failure occurred we would only log the error and not
interrupt the flow of the program. This would cause the program to continue with
the assumption that git-codereview had been installed correctly.
This change enhances the `go-contrib-init` command to exit with a bad status
code, after logging the failure, if installing git-codereview fails.
Fixesgolang/go#21040
Change-Id: Ie01d78557d54285001db61faafbb409888b2893c
Reviewed-on: https://go-review.googlesource.com/49151
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
We're at beta 2 already, so the API is likely stable.
If anything gets rolled back, we can update imports again.
Change-Id: I87e0adde062e45cab16e2bee2f929c1ac1bb828d
Reviewed-on: https://go-review.googlesource.com/49150
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This allowed me to better match the background image to the size of
the slides.
Change-Id: Ieaae93cd78582a3059ed6c3e64e740dea9088af5
Reviewed-on: https://go-review.googlesource.com/47130
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>