Documentation
¶
Overview ¶
Package fs provides filesystem related utility functions.
Index ¶
- func Chdir(v *nvim.Nvim, dir string) func()
- func Create(filename string) error
- func ExpandGoRoot(p string) string
- func FindAllPackage(root string, buildContext build.Context, ignores []string, mode FindMode) ([]*build.Package, error)
- func FindVCSRoot(path string) string
- func GbFindProjectRoot(path string) (string, error)
- func GbPackages(root string) ([]string, error)
- func GbProjectName(projectRoot string) string
- func IsDir(filename string) bool
- func IsDirExist(dir string) bool
- func IsExist(filename string) bool
- func IsGb(dir string) (string, bool)
- func IsGoFile(filename string) bool
- func IsNotExist(filename string) bool
- func JoinGoPath(p string) string
- func Mkdir(dir string, perm os.FileMode) error
- func PackageID(dir string) (string, error)
- func PackagePath(dir string) (string, error)
- func PackageRoot(path string) (*build.Package, error)
- func Rel(cwd, f string) string
- func ShortFilePath(p, cwd string) string
- func ToGoPath(p string) string
- func ToWildcard(path string) string
- func TrimGoPath(p string) string
- func VendorPath(p string) string
- type FindMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Chdir ¶
Chdir changes the vim current working directory. The returned function restores working directory to `getcwd()` result path and unlocks the mutex.
func ExpandGoRoot ¶
ExpandGoRoot expands the "$GOROOT" include from p.
func FindAllPackage ¶
func FindAllPackage(root string, buildContext build.Context, ignores []string, mode FindMode) ([]*build.Package, error)
FindAllPackage returns a list of all packages in all of the GOPATH trees in the given build context. If prefix is non-empty, only packages whose import paths begin with prefix are returned.
func FindVCSRoot ¶
FindVCSRoot finds the vcs root directory from path.
func GbFindProjectRoot ¶
GbFindProjectRoot works upwards from path seaching for the src/ directory which identifies the project root. Code taken directly from constabulary/gb.
github.com/constabulary/gb/cmd/path.go
func GbProjectName ¶
GbProjectName return the gb project name.
func IsDirExist ¶
IsDirExist reports whether dir exists and which is directory.
func IsGb ¶
IsGb check the current buffer directory whether gb directory structure. Return the gb project root path and boolean, and sets the context.GbProjectDir.
func IsNotExist ¶
IsNotExist returns whether the filename is exists.
func PackageID ¶
PackageID returns the package ID(ImportPath) estimated from the dir directory structure. like:
return "github.com/pkg/errors", nil
func PackagePath ¶
PackagePath returns the *full path* of package directory estimated from the dir directory structure. like:
return "/Users/zchee/go/src/github.com/pkg/errors", nil
func PackageRoot ¶
PackageRoot finds repository root of package from path. Return the '/root' if path is '/root/foo/bar'. If path package directory archtecture uses '/root/src/foo', returns the '/root/src'.
func ShortFilePath ¶
ShortFilePath return the simply trim cwd into p.
func ToGoPath ¶
ToGoPath trims the GOPATH and {bin,pkg,src}, basically for the converts the package ID.
func ToWildcard ¶
ToWildcard returns the path with wildcard(...) suffix.
func TrimGoPath ¶
TrimGoPath trims the GOPATH and {bin,pkg,src}, basically for the converts the package ID
func VendorPath ¶
VendorPath finds the package root and returens the vendor directory path.