1
0
mirror of https://github.com/golang/go synced 2024-09-30 16:28:32 -06:00
Commit Graph

831 Commits

Author SHA1 Message Date
David Chase
d30e00c240 splitdwarf: initial working commit
splitdwarf osxMachoFile [ osxDsymFile ]

splitdwarf takes an executable produced by go build as input,
and uncompresses and copies the DWARF segment into a separate
file in the way that is expected by OSX-hosted tools
(lldb and ports of gdb).
If osxDsymFile is not named explicitly, the default of
"<osxMachoFile>.dSYM/Contents/Resources/DWARF/<osxMachoFile>"
is used instead, with directories created as needed.

If the input file contains no UUID, then one is created by
hashing non-DWARF segment contents, and added to the
executable. This is necessary because gdb and lldb both
expect matching UUIDs to be present in the executable
and its debugging symbols.

Includes a modified version of debug/macho, with additional
definitions and the ability to write segments, sections, and
some MachO load commands added.

Change-Id: Ia5b0e289260f72bbca392cdf2c7c0a75e3ca40e5
Reviewed-on: https://go-review.googlesource.com/c/143357
Reviewed-by: Austin Clements <austin@google.com>
2019-01-09 16:56:30 +00:00
David Chase
d674b4ad67 cmd/splitdwarf: copy debug/macho
The splitdwarf command will need a modified version of debug/macho.
This is a verbatim copy from std as of Go 1.11, which we'll modify in
the next CL.

Change-Id: Ia9ded870d1ba91dad21f9f6dc5bb38f9f6cc0e80
Reviewed-on: https://go-review.googlesource.com/c/152240
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
2019-01-09 16:55:59 +00:00
Dmitri Shuralyov
9ea1c200b2 cmd/godoc: add x/website redirect
Add a redirect for the recently created x/website subrepository.

It's not yet included at https://golang.org/pkg/#subrepo because it's
in development. Once development reaches the point that x/website
is the canonical location of the golang.org server, we can consider
including x/website at https://golang.org/pkg/#subrepo (just like
x/blog, x/tour, x/build are already included there).

Updates golang/go#29206

Change-Id: I6889c1f5e40f11abca944b217a7354f76c08c8eb
Reviewed-on: https://go-review.googlesource.com/c/156337
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-01-04 17:33:42 +00:00
Iskander Sharipov
ca9055ed7d cmd/guru: fix incorrect case order in describe.go
Since *ast.CommClause implements ast.Stmt, type switch for
it would never execute in the original code, it will always
execute ast.Stmt branch.

Moving concrete types before interfaces help in this case.

Change-Id: Id84f2f7f3fac859029155d8e6debf4a8ef170b26
Reviewed-on: https://go-review.googlesource.com/c/153397
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2019-01-02 21:33:36 +00:00
Rob Pike
92cdcd90bf godoc: choose a smaller-output example as help when there are unexpected arguments
Change CL 153869 added a help message when there are leftover arguments,
as that used to invoke the command-line interface that is now gone.
But the example in the help text (go doc -all net/http) generates a huge
amount of output.

Use a very simple, small-output example instead, to illustrate how to
solve the problem without scrolling the program description hundreds
of screenfuls away.

Change-Id: I1887af1f3e853bf3a852dc374746074f1cd39441
Reviewed-on: https://go-review.googlesource.com/c/155157
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-20 02:49:03 +00:00
Filippo Valsorda
88e3b261f2 cmd/godoc: print a helpful error if used for command-line docs
The command-line interface was recently removed in favor of "go doc".

Change-Id: Idfcfca3b2eafaf63148a2ed88d4d25c61d9e3c69
Reviewed-on: https://go-review.googlesource.com/c/153869
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-19 18:50:13 +00:00
Ian Cottrell
a072e66104 internal/lsp: refactor the command line handling
This switched the golsp binary to support a sub-command model so it can grow
some guru like command line query capabilites

Change-Id: I1a7a49bb17701e62004bba636d6bee9de2481ffd
Reviewed-on: https://go-review.googlesource.com/c/154559
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2018-12-17 23:08:30 +00:00
pjw
728ed46ae0 cmd/golsp: make each log message result from a single call to fmt.Fprintf
If several RPCs finish together the existing code may mix the log
messages, making reading them difficult.

Change-Id: I1de15373f739c97ccfaf210511b5f5443f7ef036
Reviewed-on: https://go-review.googlesource.com/c/154346
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2018-12-17 18:23:37 +00:00
Brad Fitzpatrick
3c39ce7b61 tip: fix, update tip.golang.org
Primarily for golang/go#29251 but also update the base Docker layer
from Go 1.9 to Go 1.11, update other deps, and fix some Kubernetes
config cleanups that happened prior without testing apparently.

Fixes golang/go#29251

Change-Id: I0aafccdfedfc0d9ebb75d0c1a3b0819245ea5f19
Reviewed-on: https://go-review.googlesource.com/c/154181
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-14 17:12:54 +00:00
Chris Broadfoot
837e80568c godoc/proxy: remove use of httputil.ReverseProxy for /share
ReverseProxy doesn't re-set the Request's Host field, only
Request.URL.Host.
The HTTP/2 client prefers Request.Host over Request.URL.Host, so this
results in the request being sent back to the host that originally
accepted the request.
This results in an infinite redirect (and consumption of many connections to
itself).
See Issue golang/go#28168 for details.

Replace it with a simple proxy that drops all the headers (except
Content-Type).

I tried setting the proxy.Director, but it still didn't work. Could do
with some more investigation.

Fixes golang/go#28134.

Change-Id: I5051ce72a379dcacfbe8484f58f8cf7d9385024d
Reviewed-on: https://go-review.googlesource.com/c/141718
Run-TryBot: Chris Broadfoot <cbro@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-12 17:29:21 +00:00
Rebecca Stambler
feaab9440b cmd/golsp/integration/vscode: add language server client for testing
We've been using https://github.com/stamblerre/vscode-test-golsp to test
the golsp. Ideally, we'd like to add integration tests with the major
editors, so we're moving this basic extension into x/tools, with the
intention of integration tests here. This is not meant to be used by any
users of golsp; it is only for testing.

Change-Id: I7c45e7c638311d29629ff6d3291332e68cf4621a
Reviewed-on: https://go-review.googlesource.com/c/153438
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-12-10 22:45:52 +00:00
Rebecca Stambler
85346a3911 cmd/golsp: enable logging to a default location
Add a default "auto" value to the "--logfile" flag that allows logs to be
written to a default location.

Change-Id: I1952ad2622b824795906c6b8183b58f88c35fb62
Reviewed-on: https://go-review.googlesource.com/c/153197
Reviewed-by: Ian Cottrell <iancottrell@google.com>
2018-12-10 17:49:56 +00:00
Brad Fitzpatrick
d0ca3933b7 cmd/bundle: change the behavior of the -underscore flag
It used to rewrite golang.org/x/* imports to golang_org/x/*.

But https://golang.org/cl/147443 renamed golang_org/x to internal/x,
which broke the ability to run "go generate" in net/http, which runs
this command.

Given that net/http (and Go itself) is the only caller of cmd/bundle
or the -underscore flag, repurpose it to instead rewrite the
golang.org/x imports to internal/x, like CL 147443. But we keep its
name out of laziness and to minimize the number of cross-repo changes
needed.

Change-Id: I310ce8b45812a26c8b3522eaf407fffff138b1be
Reviewed-on: https://go-review.googlesource.com/c/152097
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-01 03:58:26 +00:00
Andrew Stribblehill
1c3d964395 cmd/goimports: update Emacs install instructions
When I tried to use the Emacs instructions, I found there was no go-mode-autoloads available. Searching, I found: https://github.com/dominikh/go-mode.el/issues/222

Removing the (require) line solved my problem.

I don't know what the add-to-list invocation was supposed to do, so I propose removing it too.

Change-Id: I027654dd2c634f0747dcefee71f413866049a608
GitHub-Last-Rev: 7d43dabf6a46210eaaa849900c13cd52001878cb
GitHub-Pull-Request: golang/tools#57
Reviewed-on: https://go-review.googlesource.com/c/151680
Reviewed-by: Dominik Honnef <dominik@honnef.co>
2018-11-30 05:20:23 +00:00
Austin Clements
b4e97c0ed8 cmd/stress: prefix logs with start date/time
Currently, stress logs are named "/tmp/go-stress-" plus a random
number. This makes it really annoying to tease apart failures from
different stress runs.

This CL changes the default prefix to

  "/tmp/go-stress-<ISO 8601 date/time>-<random number>"

where the date/time part is when the stress command started.  This
naming clusters logs by stress invocation, making it easy to tease
apart invocations, even if there are multiple stresses running
concurrently or they are run back-to-back.

This also provides a flag to override this prefix.

Change-Id: I043e5ee7168ba6db4e2355e39b147071edbc6864
Reviewed-on: https://go-review.googlesource.com/c/150047
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-11-27 19:52:27 +00:00
Dima
9c8bd463e3 cmd/guru: add type position to describe command
Add typepos field to json output of describe command. This field shows where
type of current (under cursor) identifier is defined. This will help code editors
implement command 'Go to type definition'.

Implements [#27308](https://github.com/golang/go/issues/27308)

Change-Id: I4e02ddbdc03fecec98135b8996f9562a88a9cfb8
GitHub-Last-Rev: be47e397a293a96d3d39776d6090d861e7904a24
GitHub-Pull-Request: golang/tools#50
Reviewed-on: https://go-review.googlesource.com/c/140379
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-11-20 20:06:22 +00:00
Agniva De Sarker
c340431777 cmd/godoc: start RunIndexer synchronously when index is present
Until the index is read completely, search requests will serve
an "indexing in progress" message. We make this synchronous
to allow the index to be read completely before starting to serve
requests.

Fixes golang/go#24965

Change-Id: I6b094374a9c5cc923f0582107dde2b652e64fd96
Reviewed-on: https://go-review.googlesource.com/c/148998
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-11-12 23:23:51 +00:00
matematik7
84d77ece31 cmd/bundle: permit empty -prefix
This enables bundling of programs with `main` method to single file.
I used this to upload code for the new codejam.

Change-Id: I9e65ba8717c1d81d6fb9bef8f234c21fc5b91421
GitHub-Last-Rev: 5d0d623c46ff1629e7371693ddf0916df328e319
GitHub-Pull-Request: golang/tools#32
Reviewed-on: https://go-review.googlesource.com/c/105515
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-11-09 15:23:16 +00:00
Ian Cottrell
96e9e165b7 cmd/golsp: format logging for the lsp inspector
This improves the logging capabilities of the jsonrpc 2 library to always
include the method and also an optional elapsed time.
This is used to implement an lsp inspector compatible logging mode in the golsp.

Change-Id: I2f7ac8b9298c4364b1b89cf6f696b534557ed139
Reviewed-on: https://go-review.googlesource.com/c/146157
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2018-11-02 22:32:51 +00:00
Agniva De Sarker
92b943e6bf cmd/tip: enable playground on tip.golang.org
Updates golang/go#28536

Change-Id: I3ece72aacd4635f4580be404672394a47791a1e8
Reviewed-on: https://go-review.googlesource.com/c/146917
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-02 05:00:50 +00:00
David Symonds
45ff765b48 cmd/stringer: accept simple type conversion expressions in constant ValueSpec
This permits constants of the form `const X = T(A)` to add `X` to the
stringer output for type `T`.

While those constants can be rewritten as `const X T = T(A)`, that
becomes tedious and visually noisy when `T` is a long name. It is quite
easy to address this easy and common case, while not attempting to solve
this with full generality.

Fixes #11581.

Change-Id: Ifb8e43515f05493de190e02577260d94dd851581
Reviewed-on: https://go-review.googlesource.com/c/146577
Run-TryBot: David Symonds <dsymonds@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2018-11-01 07:19:27 +00:00
Paul Jolly
240a8bfde1 cmd/stringer: move away from using os.Args[0]
stringer's usage currently uses os.Args[0] to refer to the program name
as a defensive measure in case stringer is compiled and then run using a
name other than stringer, e.g. mystringer. However, the following lines
of the usage docs hardcode "stringer." So it seems this has little
benefit.

Indeed this style of using os.Args[0] can make the usage information of
stringer extremely ugly when stringer itself is invoked with an absolute
path:

Usage of /tmp/tmp.ahddh3ZjE7/.gobincache/golang.org/x/tools/@v/v0.0.0-20181030000716-a0a13e073c7b/golang.org/x/tools/cmd/stringer/stringer:
        stringer [flags] -type T [directory]
        stringer [flags] -type T files... # Must be a single package

...

Instead, opt for the simpler approach of hardcoding stringer throughout.

Change-Id: Ia296c8d9a91c94e77b7cc2b6242908c959fb5985
Reviewed-on: https://go-review.googlesource.com/c/145799
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Alan Donovan <adonovan@google.com>
Reviewed-by: Rob Pike <r@golang.org>
2018-10-30 21:27:03 +00:00
Agniva De Sarker
def2677374 cmd/godoc: cleanup documentation for CLI mode
- Removed all documentation which referred to godoc's CLI capabilities.
- Added some missing flags which were not documented.
- Removed some redundant mentions of "web server" because now it is
just a web server.
- Converted some links to https

Change-Id: I7ddcf417d2bc3df13183adcfd0f82af9a37a1b91
Reviewed-on: https://go-review.googlesource.com/c/143077
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-18 18:24:39 +00:00
Brad Fitzpatrick
4cdd33fd98 cmd/tip: make tip.golang.org also serve & redirect beta.golang.org to tip
We're turning down the old (and neglected) beta.golang.org godoc VM.
It's not different enough from tip.golang.org, which is more reliable
than it used to be.

Now beta.golang.org will just redirect to tip.

Updates golang/go#25978
Fixes golang/go#21073

Change-Id: Iae7fe4c82c14cec7381e75a2e214210d38b6e623
Reviewed-on: https://go-review.googlesource.com/c/120056
Reviewed-by: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-10-17 18:38:13 +00:00
Alan Donovan
aa46a01996 go/ssa/ssautil: add AllPackages method
In go1.10, go/packages falls back to loading all packages
from source but not typechecking function bodies for imports.
The ssautil.Packages function would nonetheless provide
the partially-typed ASTs to the SSA builder, which would crash.
Now Packages only passes syntax trees to the SSA builder for
the initial packages, which are the only ones guaranteed to be
fully typed.

It is impossible to discern whether the caller of Packages intends to
build SSA code for dependencies, as in some clients such as
cmd/callgraph, so we add a new function, AllPackages, that expresses
this intent.

Fixes golang/go#28106

Change-Id: I6a88b7c7545e9de90b61f5bee0e6de3d2e21b548
Reviewed-on: https://go-review.googlesource.com/c/141686
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-10-15 18:41:29 +00:00
Andrew Bonventre
13216ffa54 cmd/present: address minor comments not applied in a previous change
These changes were suggested in golang.org/cl/140841 but were not
applied in that change. They are small documentation fixes and a
switch from using fmt.Fprintf/os.Exit to log.Fatalf.

Change-Id: I9393261f8f28b589678866dd7b8904d46629fb4b
Reviewed-on: https://go-review.googlesource.com/c/141685
Reviewed-by: Andrew Gerrand <adg@golang.org>
2018-10-13 14:52:46 +00:00
Chris Broadfoot
d3c6139142 cmd/godoc: synchronously init corpus for index mode
The corpus needs to be init'd before generating the index.

Regression caused by CL 141397.

Updates golang/go#25443.

Change-Id: I04d19bf5d279031cc8ddf0f850d81eb06fc5efa8
Reviewed-on: https://go-review.googlesource.com/c/141717
Run-TryBot: Chris Broadfoot <cbro@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-11 23:40:14 +00:00
Koichi Shiraishi
be3ddffac4 cmd/guru: fix several functions godoc comment prefix
The several functions not exported, Use "The xxx function ..." rule.

Change-Id: Iaba2490b4a9675213f70d055bd9ded9e5a245aa5
Reviewed-on: https://go-review.googlesource.com/c/47872
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-11 18:05:12 +00:00
LE Manh Cuong
1f849cf54d cmd/godoc: do not use httptest
httptest assumes it's running a test, it registers its own flags, which
means godoc ends up with mysterious flags.

By implement an http.ResponseWriter, we do not need to use httptest.

Fixes golang/go#28138

Change-Id: Ia0de8597c3edb0e7bdea6d8b3b2f1618a12f9239
Reviewed-on: https://go-review.googlesource.com/c/141417
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-11 04:24:14 +00:00
Brad Fitzpatrick
e5fe289229 godoc, cmd/godoc: remove CLI support
godoc is now just a webserver (the one that runs golang.org)

A future change might rename this to something else, but not now.

Fixes golang/go#25443

Change-Id: Ib95d0589e13f4c7a717ff28d694f1472e427eef4
Reviewed-on: https://go-review.googlesource.com/c/141397
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
2018-10-11 02:31:40 +00:00
Andrew Bonventre
37fd46feae cmd/present: merge appengine and non-appengine files
Without changing the behavior of the present command for local
usage (using the local socket for running examples, defaulting to
the current directory for all content). Add flags and set them to
the appropriate values if running on App Engine.

Notably, since the Go files must be in the same directory as
app.yaml, the content root must be ./content/ to avoid listing
the present source files.

It also defaults to running example snippets via the HTTPTransport
(https://play.golang.org/compile) instead of locally when on App
Engine.

There are also some small cleanup code changes.

Update golang/go#28080

Change-Id: I40bb7923107614f88d2bfdffd34a824d4bacb3a1
Reviewed-on: https://go-review.googlesource.com/c/140841
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-10-10 21:11:20 +00:00
Chris Broadfoot
65a9b9c4ab cmd/godoc: add missing Dockerfile ARG
Also moves the ARG declarations immediately before they're used to
make this omission less likely for future additions.

Change-Id: Id52a936d978f96d3c629feff69fc9dc4ae1b8463
Reviewed-on: https://go-review.googlesource.com/c/140377
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-10 15:29:03 +00:00
Bryan C. Mills
a2cab1077b cmd/gorename: set GO111MODULE=off in gorename_test
Updates golang/go#27858

Change-Id: Ia823c49d8f05831c833df9f745a879c94c915626
Reviewed-on: https://go-review.googlesource.com/c/139319
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-10-08 20:39:09 +00:00
Chris Broadfoot
f60d9635b1 cmd/godoc: add version info for golang.org
Adds version information for package docs for the production version of
godoc running on golang.org.

Updates golang/go#5778.

Change-Id: I8b56e8152b20b34104f274263a6c0b5a0180093b
Reviewed-on: https://go-review.googlesource.com/c/139557
Reviewed-by: Devon H. O'Dell <devon.odell@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-06 00:25:42 +00:00
Chris Broadfoot
1f2a8f46bd cmd/godoc: add cloud build config
Deploys no longer depend on Docker.

With only Make and gcloud installed, the following should deploy a new version:

$ git clone https://go.googlesource.com/tools
$ cd tools
$ cd cmd/godoc
$ make cloud-build deploy

Updates golang/go#27205.

Change-Id: I5cc1142e02dc288450d55dbd4da4b30c0a080bd5
Reviewed-on: https://go-review.googlesource.com/c/139240
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-04 02:18:13 +00:00
Chris Broadfoot
a3d532c85d cmd/godoc: add make publish to migrate traffic
Also rename `make build` and `make push` to `make docker-build` and
`make docker-push` in preparation to introduce Cloud Build (removing
the dependency on Docker).

Updates golang/go#27205.

Change-Id: Iae19b9a6f77d09246a1332c7ec9eceec449cdba8
Reviewed-on: https://go-review.googlesource.com/c/139239
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-04 01:25:03 +00:00
Bryan C. Mills
9fb5a2f241 all: set GO111MODULE=off for tests that use GOPATHs in testdata.
Some users may set GO111MODULE=on, and we will eventually want to be able to
build x/tools itself in module mode.

Updates golang/go#27858
Updates golang/go#27852

Change-Id: Iaf488b2a89e6526471530245cb580f1f0391a770
Reviewed-on: https://go-review.googlesource.com/137815
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-10-03 17:21:27 +00:00
Chris Broadfoot
2f84ea8ef8 cmd/godoc: move regression tests to a go test
Run them separately from the other tests in godoc_test by requiring a
regtest.host flag and by filtering on the test name.

Updates golang/go#27205.

Change-Id: I166d2278a3f6954307f7c935567a81e73f78e7bb
Reviewed-on: https://go-review.googlesource.com/c/139238
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-03 02:47:31 +00:00
Chris Broadfoot
390954b1ab cmd/godoc: re-enable host checking, allow test versions
test.golang.org is no longer -- instead allow access to version-specific
App Engine URLs (like 20181002t1342-dot-golang-org.appspot.com).

App Engine Flex uses the X-Forwarded-Proto to signify the proto used by
the originating request (it always uses h1 on 8080 when proxying the
request).

Updates golang/go#27205.

Change-Id: I423ffe65df325500a2fa04c7b655797ecc6ad037
Reviewed-on: https://go-review.googlesource.com/c/139237
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-03 01:52:03 +00:00
Chris Broadfoot
bdd8ae38fd cmd/godoc: improve deployment scripts, add buildinfo
* Build Go from a given version (make.bash)
* Add a /buildinfo file that describes the inputs of the
  build/deployment.
* Use Makefile/environment variables to override Go version and
  Docker tag.

Updates golang/go#27205.

Change-Id: Ia7a88b75f9d5b2319d2381e56bc963eb53e889c7
Reviewed-on: https://go-review.googlesource.com/c/138978
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-02 23:13:01 +00:00
Chris Broadfoot
ee6b03148c godoc: migrate to App Engine flexible
See bug for more details on exactly what was migrated.

Notably:
* No more Google-internal deployment scripts; see README.godoc-app and
  the Makefile for details.
* Build tag "golangorg" is used for the godoc configuration used for
  golang.org.
* Use of App Engine libraries replaced with GCP client libraries.
* Redis is used to replace App Engine memcache.
* Google analytics is controlled by an environment variable.
* Regression tests have been migrated from Google-internal.
* hg -> git hash map is moved from Google-internal.

Updates golang/go#27205.

Change-Id: Ia0a983f239c50eda8be2363494c8b784f60c2c6d
Reviewed-on: https://go-review.googlesource.com/133355
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-02 04:34:10 +00:00
Chris Broadfoot
e9ca907325 cmd/godoc: simplify dev and prod environment for App Engine
Remove all of the code generation and the concept of "APPDIR" - just
generate godoc.zip and index files in the app directory.

Simplify generation of the zip - use a symlink so that every file in
godoc.zip is under the "goroot" directory, regardless of the
environment. Previously, the prefix would be dependent on the location
of the user's GOROOT.

Running the setup script is now optional - it's now possible to run
dev_appserver.py on a regular checkout of cmd/godoc without godoc.zip
and search index files. Use environment variables to switch whether the
zip file is used vs reading GOROOT from the filesystem.

Change-Id: I1ce95c891717fe2da975f979778fd775b23f18c8
Reviewed-on: https://go-review.googlesource.com/46725
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-09-28 11:54:07 +00:00
Rebecca Stambler
d457fc8054 cmd/golsp: support formatting in golsp
This commit adds support for some basic commands necessary for
integration with VSCode. It also adds support for the
"textDocument/format" method.

Change-Id: I8fd0e33ca544ab65d3233efe2fef9716446ad4ff
Reviewed-on: https://go-review.googlesource.com/138135
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-09-27 17:02:42 +00:00
Ian Cottrell
ef04bbebd8 cmd/golsp: An empty shell of an lsp server for the go language
Change-Id: I51ef556048c2d10537ad90fa5284939e09bc31fd
Reviewed-on: https://go-review.googlesource.com/137097
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-09-27 15:24:00 +00:00
Jamie Wilkinson
9eb9690e39 cmd/goyacc: put //line annotations on the first column.
This appears to have broken since go1.11, and "go doc compile" and
https://golang.org/issue/24183 documents this new convention (point
2)

Change-Id: I6a4bc0fc51a18c17ac9a72a67d9a8eb4c879e0f9
Reviewed-on: https://go-review.googlesource.com/137515
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-09-26 03:27:08 +00:00
Michael Matloob
0aa4b8830f go/packages: remove the Config.Error hook
Errors relating to a particular package (as opposed to the Load
operation as a whole) are now only recorded in the Errors
field of the corresponding Package.
Clients are responsible for printing or otherwise handling errors.
This is a breaking API change.

The PrintErrors function prints all accumulated errors,
dependencies first, and is provided for convenience.

PrintErrors is based on Visit, another helper function, which
visits each Package in an import graph.

Also:
- add an Example documenting typical use.
- update clients to handle errors explicitly.

Depends on https://go-review.googlesource.com/c/tools/+/130576

Change-Id: I39407ab7f46dae2f0dd0fdde21080e172e1258aa
Reviewed-on: https://go-review.googlesource.com/131015
Reviewed-by: Michael Matloob <matloob@golang.org>
2018-09-04 20:52:37 +00:00
Andrew Bonventre
6cd1fcedba cmd/godoc: remove workaround for 1.8 behavior
1.8 is no longer supported. Remove code that placates it.
Also removes a superfluous newline in appinit.go.

Change-Id: I9c89b5bddf4c001d0854404114fb354209ad6024
Reviewed-on: https://go-review.googlesource.com/131715
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-28 01:58:42 +00:00
Agniva De Sarker
ba93f9405e godoc: update to use new goroot finding logic
The logic to determine whether a filesystem root was in GOROOT or GOPATH
still relied on runtime.GOROOT(), whereas cmd/godoc was updated to copy
the goroot finding logic from standard library.

Hence, godoc is unable to determine if a filesystem is in GOROOT or not
when the binary is outside runtime.GOROOT(). So we expose a new variable
and set that from cmd/godoc to avoid copying the logic again for the 3rd time.

Fixes golang/go#27162

Change-Id: I160dcdbdd262e671f09f7bf01c329be5eac280ad
Reviewed-on: https://go-review.googlesource.com/130796
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-23 15:26:32 +00:00
Brad Fitzpatrick
ef27ca3af5 cmd/godoc: redirect to https instead of http for blog.golang.org
And update some comments.

Change-Id: I4e0b7062fa0d12982ad0f9ee150635cf11ed247c
Reviewed-on: https://go-review.googlesource.com/130555
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-08-22 02:22:54 +00:00
Dominik Honnef
44ec670fe7 cmd/digraph: print usage on -h
Also switch usage printing to using stderr always, as is common for Go
tools.

Change-Id: I240da4344fe6b51a418c0d4b0b7d7e7d5614c1d7
Reviewed-on: https://go-review.googlesource.com/129776
Reviewed-by: Alan Donovan <adonovan@google.com>
2018-08-20 20:10:23 +00:00