tools/godoc
Joe Henke 5bc19071d3 godoc/vfs/zipfs: add tests; fix handling of "/"
- add tests for Open, ReadDir, and Stat funcs
- add tests for Seek of Open()
- simplify internal handling of absolute vs. "zip" paths
- fix handling of "/"

The fix special cases this scenario, leaving the codepath for all
other file paths the same. Specifically,

- Exported funcs call stat(), so stat("/") is handled by simply
returning 0 to indicate all entries are (effectively) prefixed
by "/" and zipFI{"", nil} because "/" has no name and nil
indicates it is a directory.

- ReadDir("/") is further handled by seeding the existing lookup
logic with "" instead of what would have been "/". This is
necessary because, per the zipfs spec, the zip file entries MUST
NOT start with "/", so using "/" would incorrectly match nothing.
This works because seeding lookup with "" (correctly) matches
all files and then the following, existing logic (correctly) pares
things down to just the files in the root directory; not in any
subdirectories.

Verified that godoc -zip still works.

Fixes golang/go#12743

Change-Id: Icb5f01b8a29cefa4e2820135f318894042970301
Reviewed-on: https://go-review.googlesource.com/16925
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-17 21:45:41 +00:00
..
analysis go/ssa: rename some API features (incompatible change) 2015-08-31 22:20:12 +00:00
dl godoc/{dl,proxy,short}: move packages out of Google's internal repo 2015-09-23 03:53:05 +00:00
proxy playground, godoc: remove HK and RC from share-blocked country code list 2015-09-28 23:55:41 +00:00
redirect godoc: don't drop the query params when redirecting 2015-10-06 03:11:16 +00:00
short godoc/{dl,proxy,short}: move packages out of Google's internal repo 2015-09-23 03:53:05 +00:00
static godoc/static: have makestatic use the same code header comment as stringer 2015-09-28 01:46:00 +00:00
util tools: add import comments. 2014-12-09 22:42:16 +00:00
vfs godoc/vfs/zipfs: add tests; fix handling of "/" 2015-11-17 21:45:41 +00:00
appengine.go godoc: hide and block share functionality from specific countries 2015-09-02 05:52:45 +00:00
cmdline.go godoc: add missing copyright 2015-04-27 04:29:37 +00:00
cmdline_test.go godoc: add missing copyright 2015-04-27 04:29:37 +00:00
corpus.go go.tools: use golang.org/x/... import paths 2014-11-10 08:50:40 +11:00
dirtrees.go cmd/godoc: do not apply package path restrictions onto GOROOT when indexing. 2014-10-23 09:34:01 -07:00
format.go go.tools/godoc: Fix jump-to-line in source view. 2013-08-01 11:52:25 +10:00
godoc.go x/tools/cmd/godoc: Examples should be followed by blank a newline 2015-10-28 00:50:53 +00:00
godoc_test.go go.tools/godoc: deal with fallout from $GOROOT/src/pkg -> $GOROOT/src renaming. 2014-09-10 09:02:54 -04:00
index.go go.tools: use golang.org/x/... import paths 2014-11-10 08:50:40 +11:00
index_test.go go.tools: use golang.org/x/... import paths 2014-11-10 08:50:40 +11:00
linkify.go godoc: remove the last of the global variables, unexport Server 2013-07-19 10:27:53 +10:00
meta.go go.tools: use golang.org/x/... import paths 2014-11-10 08:50:40 +11:00
page.go playground, godoc: remove HK and RC from share-blocked country code list 2015-09-28 23:55:41 +00:00
parser.go go.tools: use golang.org/x/... import paths 2014-11-10 08:50:40 +11:00
pres.go godoc: fix source links for cmd/* 2015-09-11 00:20:26 +00:00
search.go godoc: hide and block share functionality from specific countries 2015-09-02 05:52:45 +00:00
server.go godoc: fix source links for cmd/* 2015-09-11 00:20:26 +00:00
snippet.go godoc: remove more global variables 2013-07-18 13:14:09 +10:00
spec.go godoc: move bulk of the code to the package 2013-07-17 17:09:54 +10:00
spot.go godoc: add search results that point to documentation instead of source. 2013-11-21 11:55:42 -05:00
tab.go godoc: add missing copyright 2015-04-27 04:29:37 +00:00
template.go go.tools: use golang.org/x/... import paths 2014-11-10 08:50:40 +11:00