Bumping k8s dependencies to 1.13
This commit is contained in:
12
vendor/golang.org/x/tools/godoc/vfs/zipfs/zipfs.go
generated
vendored
12
vendor/golang.org/x/tools/godoc/vfs/zipfs/zipfs.go
generated
vendored
@@ -25,7 +25,6 @@ import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -87,7 +86,7 @@ func (fs *zipFS) String() string {
|
||||
func (fs *zipFS) RootType(abspath string) vfs.RootType {
|
||||
var t vfs.RootType
|
||||
switch {
|
||||
case abspath == runtime.GOROOT():
|
||||
case exists(path.Join(vfs.GOROOT, abspath)):
|
||||
t = vfs.RootTypeGoRoot
|
||||
case isGoPath(abspath):
|
||||
t = vfs.RootTypeGoPath
|
||||
@@ -95,15 +94,20 @@ func (fs *zipFS) RootType(abspath string) vfs.RootType {
|
||||
return t
|
||||
}
|
||||
|
||||
func isGoPath(path string) bool {
|
||||
func isGoPath(abspath string) bool {
|
||||
for _, p := range filepath.SplitList(build.Default.GOPATH) {
|
||||
if p == path {
|
||||
if exists(path.Join(p, abspath)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func exists(path string) bool {
|
||||
_, err := os.Stat(path)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func (fs *zipFS) Close() error {
|
||||
fs.list = nil
|
||||
return fs.ReadCloser.Close()
|
||||
|
17
vendor/golang.org/x/tools/godoc/vfs/zipfs/zipfs_test.go
generated
vendored
17
vendor/golang.org/x/tools/godoc/vfs/zipfs/zipfs_test.go
generated
vendored
@@ -187,3 +187,20 @@ func TestZipFSOpenSeek(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRootType(t *testing.T) {
|
||||
tests := []struct {
|
||||
path string
|
||||
fsType vfs.RootType
|
||||
}{
|
||||
{"/src/net/http", vfs.RootTypeGoRoot},
|
||||
{"/src/badpath", ""},
|
||||
{"/", vfs.RootTypeGoRoot},
|
||||
}
|
||||
|
||||
for _, item := range tests {
|
||||
if fs.RootType(item.path) != item.fsType {
|
||||
t.Errorf("unexpected fsType. Expected- %v, Got- %v", item.fsType, fs.RootType(item.path))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user