1
0
mirror of https://github.com/golang/go synced 2024-10-01 16:08:33 -06:00
Commit Graph

3 Commits

Author SHA1 Message Date
David R. Jenni
5984771995 x/tools/godoc: gofmt -s -w
Change-Id: Ic14a0ec2782b52a0dfe7e892af9f5549f92cb2ec
Reviewed-on: https://go-review.googlesource.com/32791
Reviewed-by: Alan Donovan <adonovan@google.com>
2017-02-15 21:42:32 +00:00
Daniel Martí
116266f628 godoc: remove some unused code
Run goimports while at it.

Change-Id: Ia3fea40835deb88bba0bb72c605bf02a6e407c88
Reviewed-on: https://go-review.googlesource.com/34953
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-01-09 19:59:23 +00:00
Hariharan Srinath
936084890a x/tools/godoc/vfs: adds NewNameSpace() and emptyVFS for better behavior
The existing implementation of NameSpace implicitly assumes that a
FileSystem with a directory at the top will be mounted at the root
mount point "/" of the NameSpace. If this is not the case, then
Stat("/") will fail even if ReadDir("/") succeedes. This is unexpected
behavior which breaks directory traversal routines (eg. http.FileServer).

This CL adds an unexported implementation of FileSystem called emptyVFS
that emulates an empty directory and adds a NewNameSpace() function that
binds emptyVFS to "/" so that unexpected behavior does not arise even if
the use does not mount anything explicitly at "/".

Latest patch set causes the FileInfo of the empty top level emulated
directory to return "/" for Name() and Zero Time for ModTime() and
removes the related struct state fields being used in the previous
implementation.

Fixes golang/go#14190

Change-Id: Idce2fc3c9b81206847a33840d76b660059d53d18
Reviewed-on: https://go-review.googlesource.com/19445
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-21 00:49:05 +00:00