Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidModPath ¶
ValidModPath reports whether a given module path is valid.
func ValidPkgPath ¶
ValidPkgPath reports whether a given module path is valid.
Types ¶
type FS ¶
type FS string
FS represents a filesystem path.
It is an absolute path, and is always in the OS-specific format.
func RootedFSPath ¶
RootedFSPath returns a new FS path. It should typically not be used except for at parser initialization. Use FS.Join, FS.New, or FS.Resolve instead to preserve the working dir.
func (FS) HasPrefix ¶
HasPrefix reports whether fs is a descendant of other or is equal to other. (i.e. it is the given path or a subdirectory of it)
func (FS) Resolve ¶
Resolve returns a new FS path to the given path. If p is absolute it returns p directly, otherwise it returns the path joined with the current path.
type MainModuleRelSlash ¶ added in v1.16.3
type MainModuleRelSlash string
MainModuleRelSlash is like RelSlash, but it's always relative to the application's main module directory.
func (MainModuleRelSlash) String ¶ added in v1.16.3
func (p MainModuleRelSlash) String() string
func (MainModuleRelSlash) ToIO ¶ added in v1.16.3
func (p MainModuleRelSlash) ToIO(mainModDir FS) string
ToIO converts the slash-separated path to a filesystem path using filepath.FromSlash.
type Mod ¶
type Mod string
Mod represents a module path. It is always slash-separated.
func StdlibMod ¶
func StdlibMod() Mod
StdlibMod returns the Mod path representing the standard library.
func (Mod) LexicallyContains ¶
LexicallyContains reports whether the given module path contains the package path p. It only considers the lexical path and ignores whether there exists a nested module that contains p.
type Pkg ¶
type Pkg string
Pkg represents a package path within a module. It is always slash-separated.
func MustPkgPath ¶
func PkgPath ¶
PkgPath returns a new Pkg path for p. If p is not a valid package path it reports "", false.
func (Pkg) JoinSlash ¶
JoinSlash joins the path with the given elems, according to path.Join. The elems are expected to be slash-separated, not filesystem-separated. Use filesystem.ToSlash() to convert filesystem paths to slash-separated paths.
func (Pkg) LexicallyContains ¶
LexicallyContains reports whether the given package path contains the package path p as a "sub-package".