1
0
mirror of https://github.com/golang/go synced 2024-10-01 03:38:32 -06:00
Commit Graph

117 Commits

Author SHA1 Message Date
Dmitri Shuralyov
1b22574ddb cmd/godoc: fix expected test output for Go 1.8 and older
A go/build change in Go 1.9 (CL 33158) allowed for a better expected
error message for "nonexistingpkg" case. CL 37768 did that. However,
that shouldn't be done for Go 1.8 and older, since they don't have
the corresponding go/build change.

So, if the version is Go 1.8 or older, allow matching those previous
expected outputs (before CL 37768) for "nonexistingpkg" case.

Move test cases for TestCLI from a package-level variable into TestCLI
itself. This is more readable, and isGo19's value is ready in time.

Fixes golang/go#20122.

Change-Id: I5e80600a75176d9e54ffebb7730849e381568316
Reviewed-on: https://go-review.googlesource.com/41810
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-26 05:21:38 +00:00
Matthew Dempsky
81dff79736 cmd/godoc: fix tests for cmd/compile refactorings
In golang.org/cl/38089, I removed all of the prog.go files.

Change-Id: I4d8dd021a62b5d6d8b7cb5cfe0ecd7268812805c
Reviewed-on: https://go-review.googlesource.com/38432
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-21 23:01:40 +00:00
Dmitri Shuralyov
f595fb5c96 cmd/godoc, godoc: implement build.Context.IsDir, update expected error string
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>
2017-03-05 21:32:12 +00:00
Dmitri Shuralyov
a663d825ff cmd/godoc: Fix package comment inconsistencies.
Remove inadvertent and unwanted spaces in the middle of an
indented block.

Insert blank lines before indented sections for consistency.

Insert colon after "pointer" for consistency with "type".

Fixes golang/go#19356.

Change-Id: Iaae12f69d17adb51a27b516727c13132cb8df8e8
Reviewed-on: https://go-review.googlesource.com/37660
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Dominik Honnef <dominik@honnef.co>
Run-TryBot: Dominik Honnef <dominik@honnef.co>
2017-03-04 00:53:44 +00:00
David R. Jenni
e06694fefd x/tools/cmd/godoc: remove unused variable
Found with honnef.co/go/tools/cmd/unused.

Change-Id: I3db2aad14de33f0be69569cd355e453173098358
Reviewed-on: https://go-review.googlesource.com/37599
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-03-01 14:52:40 +00:00
Ted Kornish
396c176f11 godoc: preserve ?m=... query string
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>
2017-02-08 21:12:11 +00:00
Hsin Tsao
f5bb18ad35 cmd/godoc: add better user error messages
Fixes golang/go#14280

Change-Id: I3151a17ce9553d0a7fe56c2d614e3a6f6a96344c
Reviewed-on: https://go-review.googlesource.com/36472
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-07 01:00:00 +00:00
Kevin Burke
cb538dbcf8 godoc: add README
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>
2017-01-09 19:14:34 +00:00
Russ Cox
908849c337 cmd/godoc: add perf subrepo
For golang/go#14304.

Change-Id: Ia90193d3a9ad027231f977ffa6b66cf60ea40683
Reviewed-on: https://go-review.googlesource.com/34615
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-20 20:09:41 +00:00
Brad Fitzpatrick
0f86c627e2 cmd/godoc: optional ACME autocert support
If built with the "autocert" build tag, use
golang.org/x/crypto/autocert and for automatic TLS certs.

This will be used for https://beta.golang.org/ running on GCE.

Change-Id: Id0e385796a25d663708ea9bb65c45cb1471dd526
Reviewed-on: https://go-review.googlesource.com/33751
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-11-30 23:52:24 +00:00
Alan Donovan
242b5dc780 godoc: changes to support aliases
Fixes golang.org/go#17763

Change-Id: I18012dcfd878db916cbb940c3a361a89341b9209
Reviewed-on: https://go-review.googlesource.com/32711
Reviewed-by: Robert Griesemer <gri@golang.org>
2016-11-03 21:57:37 +00:00
Brad Fitzpatrick
a2b1312ca0 cmd/godoc: increase test timeout
Darwin was flaking. Its HFS filesystem is probably too slow.

Change-Id: I44ea6de8dae8054d41c94c0c36e703e62fbdfcd9
Reviewed-on: https://go-review.googlesource.com/30954
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-10-12 16:04:38 +00:00
Brad Fitzpatrick
41f4ee4e59 cmd/godoc, cmd/fiximports: fix or skip failing tests at tip
Fix godoc test failure.

Skip fiximports test failure for now, to not hide other
failures. (tracking bug to fix properly in golang/go#17417)

x/tools being broken is preventing use of trybots for unrelated CLs.

Change-Id: I3a1deee4036096e0377cf8b63fabe444c58dd86e
Reviewed-on: https://go-review.googlesource.com/30953
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2016-10-12 15:24:30 +00:00
Mohit Agarwal
73d2e795b8 cmd/godoc: fix command for creating the zip file
The `-r` option (to recurse into directories) need to be specified
else the created file consists only of the specified directory and
nothing else.

Change-Id: I624184fc2e88998a3119c12f8c328603588c123c
Reviewed-on: https://go-review.googlesource.com/17283
Reviewed-by: Russ Cox <rsc@golang.org>
2016-10-04 20:51:58 +00:00
Andrew Gerrand
c9a2436076 cmd/godoc: set Strict-Transport-Security header in production
This coerces browsers into enforcing HTTPS-only for golang.org.

Change-Id: I91a4cc64b10b9836ef5623314a3cf22a54033dc2
Reviewed-on: https://go-review.googlesource.com/22673
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-02 17:22:30 +00:00
Larz Conwell
9a6ae37d4e cmd/godoc: accept GOOS and GOARCH URL parameters in -http mode
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>
2016-02-04 22:11:53 +00:00
Brad Fitzpatrick
b47dfd93e5 all: fix plan9 failures
Updates golang/go#11811

Change-Id: I6ed252eb3272354fce8084ec99f4777e41c3daa3
Reviewed-on: https://go-review.googlesource.com/18993
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2016-01-28 00:31:03 +00:00
Andrew Gerrand
9cd799205e cmd/godoc: add redirect for x/term repo
Update golang/go#13104

Change-Id: I76102038d8dc87503c9a8994f9008b1a9fdb19d4
Reviewed-on: https://go-review.googlesource.com/17020
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-11-18 05:08:28 +00:00
Andrew Gerrand
dec63b8e98 cmd/godoc: add x/time and x/sync redirects
Fixes golang/go#13133

Change-Id: I45031352d4d7c040889134310ad5721dd9dcc1ee
Reviewed-on: https://go-review.googlesource.com/16640
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-04 02:28:00 +00:00
Andrew Gerrand
10179a7e86 cmd/godoc: set Content-Type in fmt handler
Change-Id: I51b12838c65d67d4323e07d70f7c1e66fce23251
Reviewed-on: https://go-review.googlesource.com/14938
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-28 02:55:19 +00:00
Mhd Sulhan
2b5f3dc0de cmd/godoc: make setup-godoc-app.bash more portable
Unlike in BSD, in GNU/Linux find option for -depth is without an
argument. To make the command compatible in both system, use
-mindepth and -maxdepth arguments.

Change-Id: Ie82736fd2c28b6fe0f64dbfc7272f0e0f0d8e8df
Reviewed-on: https://go-review.googlesource.com/15014
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-27 06:24:22 +00:00
Andrew Gerrand
6b41c776c8 cmd/godoc: always serve fmt handler, HTTPS fix redirection
Change-Id: Ib00a54f40b3c52c9bc6a07623259c5c82f9d28d9
Reviewed-on: https://go-review.googlesource.com/14933
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-25 02:10:07 +00:00
Andrew Gerrand
c206e42859 cmd/godoc: serve proxy paths without host enforcer
Change-Id: I4647c1e18df3ea441c5220cd03fe6163794b7e84
Reviewed-on: https://go-review.googlesource.com/14862
Reviewed-by: Chris Broadfoot <cbro@golang.org>
2015-09-23 05:23:18 +00:00
Andrew Gerrand
e83bc56334 godoc/{dl,proxy,short}: move packages out of Google's internal repo
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>
2015-09-23 03:53:05 +00:00
Andrew Gerrand
40b1b219de cmd/godoc: restrict requests to HTTPS and canonical host names
Fixes golang/go#12684

Change-Id: Ibb49e604bfd92c902c9fd2bf9506ded60b2a9d8d
Reviewed-on: https://go-review.googlesource.com/14814
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-22 23:49:55 +00:00
Andrew Gerrand
31971b7521 godoc: fix source links for cmd/*
Fixes golang/go#12159

Change-Id: Id498443171cbdf0fe9808745a79edc863d836db1
Reviewed-on: https://go-review.googlesource.com/14001
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-11 00:20:26 +00:00
Andrew Gerrand
513c731aab cmd/godoc: add x/arch repo to list
Fixes golang/go#12393

Change-Id: I0b56c36dec11a6c2fddcc092867f24701815dce3
Reviewed-on: https://go-review.googlesource.com/14145
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-09-01 03:09:27 +00:00
Robert Griesemer
32dcbb4ccc cmd/godoc: exclude TestTypeAnalysis on Plan 9 for now
Attempt to make build work on Plan 9.

For golang/go#11811.

Change-Id: I37a5eaef441262342994a8f77c86aa5e120deea7
Reviewed-on: https://go-review.googlesource.com/13033
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-07-31 22:39:36 +00:00
Andrew Gerrand
d1eaf38956 cmd/godoc: don't run indexer test in -short mode
It takes too long for the builders.
Also remove GOPATH from the environment when indexing.

Change-Id: I9a3f2628f248bdbf9dce97119c2fbb7cbd63f3fe
Reviewed-on: https://go-review.googlesource.com/12917
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-31 05:12:20 +00:00
David Crawshaw
5c915edf62 cmd/godoc: redirect /x to subrepo page
Fixes golang/go#9061.

Change-Id: Ibe5764932bb8e223e7f838415f84bc330eb5d818
Reviewed-on: https://go-review.googlesource.com/12082
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-07-13 18:17:26 +00:00
Dave Cheney
0ee0dd6ea8 cmd/godoc: skip tests on arm platforms
Skip tests on arm platforms.

The godoc tests require large amounts of memory, in excess of 700mb in -index mode which none of the arm builders have spare.

Because of their requirements the tests can be killed by the test runner leaving stray godoc processes spinning in swap trying to -index.

Change-Id: I1544d56e9d9aabbbaac21adeebfb9e2690bd2da5
Reviewed-on: https://go-review.googlesource.com/7540
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-16 02:06:44 +00:00
Péter Surányi
8239116d59 cmd/godoc: exclude /pkg from search indexing
On tip, search included redundant source results from /pkg/bootstrap
(with broken links as godoc doesn't support source files under /pkg).
This change excludes all directories under /pkg from indexing.

Fixes golang/go#10024.

Change-Id: I0c69d22ff08d131f9c37c91a7711db6a4ec53fd4
Reviewed-on: https://go-review.googlesource.com/7267
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-12 00:26:38 +00:00
Péter Surányi
c327a7c00b cmd/godoc: add -index_interval
Updates golang/go#9996.

Change-Id: I6112b1c32832aaa6604b096cfe7a8833f092b17a
Reviewed-on: https://go-review.googlesource.com/7031
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-03-06 23:07:47 +00:00
Andrew Gerrand
88df7a741d cmd/godoc: add golang.org/x/tour meta redirect
Change-Id: I2b855bb166612af391bb99742f6b6d58bc3ec226
Reviewed-on: https://go-review.googlesource.com/4340
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-02-10 05:48:21 +00:00
Andrew Gerrand
d702aaaabe cmd/godoc: add golang.org/x/build to go-import redirect list
Change-Id: Id372b2da716b31bc016855d2d7f783fd1764e5c0
Reviewed-on: https://go-review.googlesource.com/3110
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-21 06:59:18 +00:00
Hyang-Ah Hana Kim
e14d0b6f6b cmd/godoc: godoc test needs clean up tmp dir when buildGodoc fails.
Change-Id: I584ed27d37a85d39294b07febf396f567d4016a5
Reviewed-on: https://go-review.googlesource.com/2901
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-15 18:36:28 +00:00
Andrew Gerrand
af97332187 cmd/godoc: send go-source meta tag for golang.org/x repos
This allows godoc.org to link to the source code. I chose to link to
github.com instead of googlesource.com because their file browser is
better.

Details here:
864b1c0aba

Change-Id: I962b3fadc822e753245f52240937be5c7e158dc7
Reviewed-on: https://go-review.googlesource.com/2719
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-14 02:42:10 +00:00
Péter Surányi
bd69d2dd34 cmd/godoc: mention examples feature in godoc
Godoc documentation did not mention the feature for showing example code
runnable by the testing package. Add a link to the testing package.

Update golang/go#9471

Change-Id: Ic15794c59732e9b0b42c5b16c60be0a47c41afa5
Reviewed-on: https://go-review.googlesource.com/2490
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-01-08 02:02:02 +00:00
Andrew Gerrand
c836fe615a cmd/godoc: add golang.org/x/playground custom import path
Change-Id: Ic399dbf8a77e7c61ba8be263515b13a6b488b4e9
Reviewed-on: https://go-review.googlesource.com/2309
Reviewed-by: Rob Pike <r@golang.org>
2015-01-06 02:12:10 +00:00
Shenghou Ma
f72c7f7642 cmd/godoc: show the BUG section
This will match the default behavior when running locally.

In fact, our http://blog.golang.org/godoc-documenting-go-code explicitly
documents this feature (see also golang.org/cl/1953).

Change-Id: I581b17b60229ce70900cb51d548d1e2a34df41ba
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/2116
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-28 23:27:51 +00:00
Emil Hessman
864e280a1d cmd/godoc: add missing space to flag description
Change-Id: I8f4dada13353065475baf33c71e6e1a28f889e71
Reviewed-on: https://go-review.googlesource.com/1892
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2014-12-19 19:42:26 +00:00
Oling Cat
65b875be27 cmd/godoc: update GAE setup script
Change-Id: Ief2c49a03cbd3251d62d854be4f51dcb27a42458
Reviewed-on: https://go-review.googlesource.com/1522
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-19 02:48:01 +00:00
Brad Fitzpatrick
88d370fb93 cmd/godoc: add debug subrepo meta to x handler
Change-Id: I0ba56b32dd9b53d06817f9f7e2dafff04e6a86d2
Reviewed-on: https://go-review.googlesource.com/1565
Reviewed-by: David Symonds <dsymonds@golang.org>
2014-12-15 04:44:49 +00:00
David Symonds
24257c8cd2 tools: add import comments.
Change-Id: Idda6e64580432cb9a731e4ebf4005ee4ceb4202d
Reviewed-on: https://go-review.googlesource.com/1244
Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-12-09 22:42:16 +00:00
Andrew Gerrand
9e66c59fb1 x/tools/cmd/godoc: update golang.org/x/ redirects to point to git repos
LGTM=dsymonds
R=dsymonds
CC=golang-codereviews
https://golang.org/cl/182620043
2014-12-08 10:30:52 +11:00
Andrew Gerrand
354b6ccbcc x/tools/cmd/godoc: add golang.org/x/oauth2 import path
LGTM=r
R=jbd, r
CC=golang-codereviews
https://golang.org/cl/175700043
2014-11-26 15:31:30 +11:00
Andrew Gerrand
4f9827a99d x/tools/cmd/godoc: fix bad repository path
Not caught by inattentive reviewer. Pick up your game, people.

LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/180880043
2014-11-19 15:51:44 +11:00
Andrew Gerrand
1536a92c03 x/tools/cmd/godoc: add golang.org/x/review custom import path
LGTM=r
R=r
CC=golang-codereviews
https://golang.org/cl/174410043
2014-11-19 14:03:19 +11:00
Andrew Gerrand
5ebbcd132f go.tools: use golang.org/x/... import paths
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
2014-11-10 08:50:40 +11:00
Andrew Gerrand
5d1cfb1968 go.tools/cmd/godoc: add handlers for new sub-repo paths
Fixes golang/go#9009.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/162470043
2014-10-31 09:01:52 +11:00