/usr/share/gocode/src/github.com/smartystreets/goconvey/web/server/system/file_system.go is in golang-github-smartystreets-goconvey-dev 1.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | package system
import (
"io/ioutil"
"log"
"os"
"path/filepath"
"strings"
)
type FileSystem struct{}
func (self *FileSystem) Walk(root string, step filepath.WalkFunc) {
err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
if self.isMetaDirectory(info) {
return filepath.SkipDir
}
return step(path, info, err)
})
if err != nil {
log.Println("Error while walking file system:", err)
panic(err)
}
}
func (self *FileSystem) isMetaDirectory(info os.FileInfo) bool {
name := info.Name()
return info.IsDir() && (strings.HasPrefix(name, ".") || strings.HasPrefix(name, "_") || name == "testdata")
}
func (self *FileSystem) Listing(directory string) ([]os.FileInfo, error) {
return ioutil.ReadDir(directory)
}
func (self *FileSystem) Exists(directory string) bool {
info, err := os.Stat(directory)
return err == nil && info.IsDir()
}
func NewFileSystem() *FileSystem {
return &FileSystem{}
}
|