1
0
mirror of https://github.com/golang/go synced 2024-11-05 20:36:10 -07:00
Commit Graph

2357 Commits

Author SHA1 Message Date
Johan Brandhorst
e531a2a1c1 present: remove extraneous line
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>
2017-09-15 04:02:03 +00:00
Andrew Bonventre
aebcdfcd02 godoc: use Google’s CDN edge cache to serve downloads
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>
2017-09-14 20:43:14 +00:00
Andrew Bonventre
3b1faeda9a imports: fix +build tags to exclude syscall deps on appengine
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>
2017-09-01 21:04:08 +00:00
Martin Möhrmann
421c33e678 godoc: update out of sync static.go
Replace references to Share by GoogleCN.

Fixes golang/go#21725

Change-Id: I6db4aa282cca7c104cbe34b40d152aa53ce07280
Reviewed-on: https://go-review.googlesource.com/60851
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2017-09-01 14:00:58 +00:00
Carl Johnson
e00c182679 present: Scale down slides on smaller displays
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.

Fixes golang/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>
2017-08-31 21:56:44 +00:00
Andrew Bonventre
2d19ab38fa godoc: hide link to blog in header in CN
Change-Id: I952ce003edecdd62179a8dfbc3c0e56f78eecfb1
Reviewed-on: https://go-review.googlesource.com/60071
Reviewed-by: Andrew Bonventre <andybons@golang.org>
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-29 20:47:10 +00:00
griesemer
1736caf17f present: fix link in documentation
Change-Id: I53e2e9009eebdc38a6f6f4f639a1bd7e14ccf188
Reviewed-on: https://go-review.googlesource.com/59010
Reviewed-by: Kevin Burke <kev@inburke.com>
Reviewed-by: Rob Pike <r@golang.org>
2017-08-27 12:20:53 +00:00
Radu Berinde
1807494da8 x/tools/container/intsets: add LowerBound
Fixes golang/go#21310.

Change-Id: Id3f23a66b9889a5087c1f83e7d672d14c41a59e3
Reviewed-on: https://go-review.googlesource.com/53432
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-08-21 16:11:21 +00:00
Radu Berinde
43e94ff202 x/tools/container/intsets: use root block
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%      ~

Fixes golang/go#21311.

Change-Id: Ie472a2afa269c21cb33b22ffdac8dd2594b816ac
Reviewed-on: https://go-review.googlesource.com/53431
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-08-21 15:22:10 +00:00
haya14busa
84a35ef54d go/ast/astutil: new third-party imports shouldn't go in the std group
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"
	)

Fixes golang/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>
2017-08-15 00:39:00 +00:00
Dmitri Shuralyov
5831d16d18 cmd/callgraph: fix "import path of the enclosing package" example in usage
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.

Fixes golang/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>
2017-08-08 14:46:45 +00:00
Ian Lance Taylor
f03b3350b7 godoc: don't try to follow all symlinks
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#15049
Fixes golang/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>
2017-08-07 23:14:37 +00:00
Axel Wagner
0f5d61c4c1 imports: print dir of candidates in addition to import path
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>
2017-08-06 16:51:46 +00:00
Andrew Bonventre
a237aba5f5 godoc: fix out-of-bounds panic when serving top-level files
Change-Id: I0ba84bac0c97715c0bc66fdc4c33678341ef140c
Reviewed-on: https://go-review.googlesource.com/53151
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-08-04 00:32:20 +00:00
Andrew Bonventre
4e70a1b26a godoc: add GoogleCN property to pages
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>
2017-08-02 21:09:52 +00:00
Jaana Burcu Dogan
fcc44a6330 cmd/getgo: add a user-agent to download requests
Change-Id: Ic8fa61e53e2d06a02b06b685bd1082423df00825
Reviewed-on: https://go-review.googlesource.com/52530
Run-TryBot: Jaana Burcu Dogan <jbd@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2017-08-01 21:43:54 +00:00
Brad Fitzpatrick
3fd990c6be cmd/tip: fix the build
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>
2017-08-01 18:51:51 +00:00
Brad Fitzpatrick
d07a458d9a cmd/tip: add a cert cache, clean up Kubernetes config, use update-deps
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.

Fixes golang/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>
2017-08-01 15:37:25 +00:00
Jaana Burcu Dogan
9badcbe49b cmd/getgo: prompt warning if an earlier installation exists
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>
2017-07-31 22:15:19 +00:00
Andrew Bonventre
6fdd948b81 godoc: remove disabled admin code
Change-Id: If3e2264b874c7a5447929888fed0ce6ad61f3475
Reviewed-on: https://go-review.googlesource.com/52291
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2017-07-31 20:07:38 +00:00
Chris Broadfoot
f2b3bb0049 cmd/getgo: fix builds
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>
2017-07-31 18:28:23 +00:00
Jaana Burcu Dogan
001b4ec819 cmd/getgo: have consistent messages
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>
2017-07-31 17:12:47 +00:00
Jaana Burcu Dogan
29518d98f4 cmd/getgo: display that -i stands for interactive mode
Change-Id: Ia6d8b0e9b2a355d2c4b41634fd51de51187be833
Reviewed-on: https://go-review.googlesource.com/51931
Reviewed-by: Kevin Burke <kev@inburke.com>
2017-07-31 17:04:26 +00:00
Andrew Bonventre
5724bdc2fd x/tools/godoc: fix redirect to Gerrit
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.

Fixes golang/go#21235

Change-Id: Ie30e01bedd7a8277aedd4070b5f82a754521ed03
Reviewed-on: https://go-review.googlesource.com/52150
Reviewed-by: Kevin Burke <kev@inburke.com>
2017-07-31 16:24:22 +00:00
Chris Broadfoot
ac1e4b1998 cmd/getgo: initial commit
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>
2017-07-28 18:26:31 +00:00
Matthew Dempsky
3da34b1b52 cmd/gorename: disable TestGeneratedFiles for !cgo builds
Fixes golang/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>
2017-07-17 21:59:59 +00:00
Tim Heckman
807424b52b cmd/go-contrib-init: exit with an error if package install fails
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.

Fixes golang/go#21040

Change-Id: Ie01d78557d54285001db61faafbb409888b2893c
Reviewed-on: https://go-review.googlesource.com/49151
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-17 03:20:55 +00:00
Josh Bleecher Snyder
478150226d imports: update zstdlib to Go 1.9
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>
2017-07-17 03:03:41 +00:00
Edward Muller
41b76ca51c present: Set the background using CSS
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>
2017-07-17 00:28:30 +00:00
Andy Walker
d78e5d2552 refactor/eg: already documented; remove TODO
Change-Id: I7166006a3a922505a5f0a619bd98c0a1505831bc
Reviewed-on: https://go-review.googlesource.com/48981
Reviewed-by: Leo Rudberg <ljr@google.com>
Reviewed-by: Ross Light <light@google.com>
Run-TryBot: Ross Light <light@google.com>
2017-07-15 20:28:46 +00:00
Austin Clements
7a4327eb7a cmd/go-contrib-init: don't crash from src/golang.org/x
If go-contrib-init is executed from the src/golang.org/x directory (as
opposed to a sub-directory), it crashes with an index out-of-bounds.

Fix this by including the trailing slash in the inspected path prefix
so we never slice more than what we know is in the string.

Change-Id: Ibbb74759c2ba839972de34a8ffb28b6cfb6825e2
Reviewed-on: https://go-review.googlesource.com/48690
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-15 16:38:41 +00:00
Michael Edwards
4ce273956a 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.

Fixes golang/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>
2017-07-14 21:15:33 +00:00
Kevin Burke
6f1996fdfe cmd/go-contrib-init: better GOPATH checkout error message
Modify the error message to provide more context if the user is in the
wrong directory. (The default Terminal.app does not do a great job of
showing what directory you are currently in).

Change-Id: Iafcbbd2070ca968863120fb8c4bc15609475cda2
Reviewed-on: https://go-review.googlesource.com/48232
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-13 05:25:58 +00:00
Leo Rudberg
7a94893dc3 cmd/eg: Gofmt eg's dry-run output.
The content of the dry-run and the actual (file-editing) run should now
be the same.

Change-Id: If89f85838f7f53f14ffa4e2b6a425507835dda62
Reviewed-on: https://go-review.googlesource.com/48210
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-13 04:09:46 +00:00
Kevin Burke
76622760f0 cmd/go-contrib-init: match subdomain-less .gitcookies file
My `.gitcookies` file starts with ".googlesource.com", which
errored because it did not match "go.googlesource.com" or
"go-review.googlesource.com". Fix this by optionally matching on
"go.googlesource.com" or ".googlesource.com".

Fixes golang/go#20992.

Change-Id: I29d3c0b1e958382495a90502f280bdb52868c2c7
Reviewed-on: https://go-review.googlesource.com/48230
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-13 03:45:07 +00:00
Hiroshi Ioka
bce9606b3f cmd/bundle: include non-associated comments
https://golang.org/cl/45117 doesn't handle comments which don't
belong to any declarations. This CL addresses it.

Fixes golang/go#20627

Change-Id: I81c7cdc070efc6cb9e9f38101d7b2b8909916ba6
Reviewed-on: https://go-review.googlesource.com/45190
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-07-07 17:27:36 +00:00
suzmue
9dc2b714a0 cmd/gorename: add tests that run successfully
Set the env variable to only include the correct gopath in the test.

Fixes golang/go#20805

Change-Id: I496ed5c60278e508016f915cf53a115cc3c222ae
Reviewed-on: https://go-review.googlesource.com/47410
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-07-07 17:24:26 +00:00
Brad Fitzpatrick
6e57528ade imports: fix reading from stdin on Windows
Don't panic when reading from stdin on Windows. This is a regression
from https://golang.org/cl/43454

Also fix some weird behavior with stdin processing I noticed during
reviewing the code: don't allow the -w (write) flag, and adust the
filename shown with the -d (diff) flag.

Fixes golang/go#20941

Change-Id: I73d0a1dc74c919238a3bb72823585bbf1b7daba1
Reviewed-on: https://go-review.googlesource.com/47810
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Jones <rbjones@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-07 17:20:05 +00:00
Brad Fitzpatrick
72ed06fbe2 godoc: include dir listing in rate limit, log dir reading errors
Updates golang/go#14252

Change-Id: I3ce2a410708900f5c80d15e722b410855fd9c571
Reviewed-on: https://go-review.googlesource.com/47651
Reviewed-by: Dmitri Shuralyov <shurcool@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-06 20:06:05 +00:00
Kirill Smelkov
c2d03f470b go/loader: Fix thinko in FindPackage hook signature
(*build.Context).Import has signature of

	(ctx, importPath, fromDir, mode)

not

	(ctx, fromDir, importPath, mode)

and the loader actually uses the first version.

The thinko was introduced in d6e83e53 (go/loader: changes for vendor
support; CL 18053) and was possible because importPath and fromDir both
have the same type string.

Fix it.

Change-Id: I52deaec6d141846b8a495835b121c1bdc2864215
Reviewed-on: https://go-review.googlesource.com/47343
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-07-05 16:38:48 +00:00
Brad Fitzpatrick
1b3bb8de7d godoc/dl: change OS X to macOS, clarify WinXP requirement
Change-Id: Ib90881aef9c1bec0339dbbc38cbb320d5b731d97
Reviewed-on: https://go-review.googlesource.com/47251
Reviewed-by: Andrew Bonventre <andybons@google.com>
2017-06-29 19:46:10 +00:00
Brad Fitzpatrick
9be3b7cbc7 godoc/dl: update some pretty GOARCH strings
Fixes golang/go#19082

Change-Id: Id0e985eeff543ad24ff969ff8c94e086a7bc9303
Reviewed-on: https://go-review.googlesource.com/46916
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2017-06-29 18:26:36 +00:00
Koichi Shiraishi
e6cb469339 imports: fix LocalPrefix document prefix
golint suggested:
  comment on exported var LocalPrefix should be of the form "LocalPrefix ..."

Change-Id: I1d2f92ba76e3c091440f676936dbb1fc1ce07f3a
Reviewed-on: https://go-review.googlesource.com/46432
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-06-23 12:26:59 +00:00
Alan Donovan
da9759ca30 cmd/bundle: fix nil dereference panic
In the loader API, (*Config).Import, like go/build, accepts relative
paths such as ".", but (*Program).Package requires the exact path of a
loaded package.  So, to find the package identified by "." we must
look at the set of packages actually loaded, which in this scenario is
guaranteed to be a singleton.

(This is a definite weakness of the loader API.  In the more general
case where two or more packages are imported, it's tricky to correlate
the calls to Import with the package(s) each call actually loads.)

Fixes golang/go#20751

Change-Id: I925e969c9b4f4d6b6344c16f156b47857436d70a
Reviewed-on: https://go-review.googlesource.com/46414
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2017-06-23 02:24:18 +00:00
Suzy Mueller
1ab5277e83 refactor/rename: fail cleanly when attempting to rename cgo files
Previous implementation will overwrite files the import "C" with the
cgo preprocessing and renaming. Rename will now emit an error when
rename must edit files that import "C". Will also emit more useful
error when using -offset in a "C" importing file.

Fixes golang/go#17839

Change-Id: I072100b22197ec145b56d727feca58be7529e359
Reviewed-on: https://go-review.googlesource.com/45930
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-06-23 01:23:57 +00:00
Yasuhiro Matsumoto
545ce0dcdd tools: handle paths like ~/ or $HOME/.
tilde should be located at the beginning of line.

Change-Id: I271ba5220da3c483838d1741d908755aee8e081e
Reviewed-on: https://go-review.googlesource.com/46430
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-06-22 02:08:34 +00:00
Koichi Shiraishi
cd6e398dae cmd/git-contrib-init: support http.cookiefile config for gitcookies
Change-Id: I097905122e1cb7298c31c330731f0fc3c6fc9b59
Reviewed-on: https://go-review.googlesource.com/46235
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-06-21 15:43:17 +00:00
Koichi Shiraishi
601a54bfa3 cmd/go-contrib-init: fix get GOPATH env logic
Go runtime now uses user homedir+go (i.e. $HOME/go) if GOPATH
environment variable is not set.

Change-Id: I26d90e07976a5311ea19de8a6e2c63830b802882
Reviewed-on: https://go-review.googlesource.com/46234
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-06-21 05:03:32 +00:00
Alan Donovan
63c6481f3b go/loader: fix a data race
The loader was calling (*types.Checker).Files on the "unsafe" package,
a global variable.  Even with zero files, this operation is not a no-op
because it sets the package's "complete" flag, leading to a data race.
(Because Unsafe.complete is already set at construction, the
race is benign, but is reported by -race nonetheless.)

Fixes golang/go#20718

Change-Id: I5a4f95be5ab4c60ea3b6c2a7fb6f1b67acbf42bc
Reviewed-on: https://go-review.googlesource.com/46071
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-06-19 17:45:44 +00:00
Sina Siadat
5128de7288 godoc: add links to docs in text and dir pages
Fixes golang/go#17125

Change-Id: I22dd0561cd1c8eb30524797b6c0488d08a65285b
Reviewed-on: https://go-review.googlesource.com/29279
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-06-16 21:49:54 +00:00