1
0
mirror of https://github.com/golang/go synced 2024-11-18 13:34:41 -07:00
go/godoc/vfs
Dmitri Shuralyov ead0a56930 godoc/vfs/mapfs: panic on invalid New usage
mapfs.New documentation says:

> Map keys should be forward slash-separated pathnames
> and not contain a leading slash.

It is invalid input if a provided path contains a leading slash, and it
causes the returned filesystem to have undefined behavior. Package mapfs
is often used in tests, so this can lead to a serious problem elsewhere.

Help detect invalid API usage sooner by validating input, and panicking
when it contains leading slashes. Programs that use mapfs API correctly
will be unaffected, and it will be faster for incorrect programs—if any
exist today or will be created in the future—to detect and correct such
problems.

Fixes golang/go#34591.

Change-Id: I77e5f0f4628edf83480604135f58bfb62e521d80
Reviewed-on: https://go-review.googlesource.com/c/tools/+/197859
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
2020-05-08 23:23:36 +00:00
..
gatefs godoc/vfs: improve implementation of RootType 2018-04-11 20:41:25 +00:00
httpfs tools: add import comments. 2014-12-09 22:42:16 +00:00
mapfs godoc/vfs/mapfs: panic on invalid New usage 2020-05-08 23:23:36 +00:00
zipfs godoc/vfs/zipfs: fix godoc formatting 2019-10-07 15:17:16 +00:00
emptyvfs.go all: remove many cases of space-space 2019-12-30 19:07:42 +00:00
namespace_test.go godoc/vfs: fix union logic in NameSpace.ReadDir 2019-09-30 20:11:59 +00:00
namespace.go all: remove many cases of space-space 2019-12-30 19:07:42 +00:00
os_test.go godoc/vfs: improve implementation of RootType 2018-04-11 20:41:25 +00:00
os.go godoc/vfs: improve comment on GOROOT 2018-08-26 00:05:47 +00:00
vfs.go godoc/vfs: improve implementation of RootType 2018-04-11 20:41:25 +00:00