Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExternalPathResolver ¶
type ExternalPathResolver interface { // RelPathToExternalPath takes a path relative to the asset and converts it // to a path that is external to the asset. // // This path is not necessarily a file path, and should only be used to // uniquely identify this file as compared to other assets, and for display // to users. // // The input path will be normalized and validated. // The output path will be unnormalized, if it is a file path. // // Example: // Directory: /foo/bar // RelPath: baz/bat.proto // ExternalPath: /foo/bar/baz/bat.proto // // Example: // Directory: . // RelPath: baz/bat.proto // ExternalPath: baz/bat.proto RelPathToExternalPath(relPath string) (string, error) }
ExternalPathResolver resolves relative paths to external paths.
type PathResolver ¶
type PathResolver interface { RelPathResolver ExternalPathResolver }
PathResolver resolves both external and relative paths.
var NopPathResolver PathResolver = newNopPathResolver()
NopPathResolver is a PathResolver that is a no-op.
This PathResolver will still normalize and validate fields per the requirements.
func NewDirPathResolver ¶
func NewDirPathResolver(dirPath string) PathResolver
NewDirPathResolver returns a PathResolver for a directory.
The dirPath will be normalized.
type RelPathResolver ¶
type RelPathResolver interface { // ExternalPathToRelPath takes a path external to the asset and converts it to // a path that is relative to the asset. // // The returned path will be normalized and validated. // // Example: // Directory: /foo/bar // ExternalPath: /foo/bar/baz/bat.proto // RelPath: baz/bat.proto ExternalPathToRelPath(externalPath string) (string, error) }
RelPathResolver resolves external paths to relative paths.
Click to show internal directories.
Click to hide internal directories.