Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadWalkPackage ¶
func ReadWalkPackage(pkg Package, fn PackageReadWalkFunc) error
Types ¶
type FSResolver ¶
type FSResolver struct {
// contains filtered or unexported fields
}
func NewFSResolver ¶
func NewFSResolver() *FSResolver
func (*FSResolver) LoadPackages ¶
func (r *FSResolver) LoadPackages(root string, pkgHandler PackageHandler) error
LoadPackages lists all packages in the directory (excluding those which can't be processed).
func (*FSResolver) ResolveName ¶
func (r *FSResolver) ResolveName(pkgname string) []Package
func (*FSResolver) ResolvePath ¶
func (r *FSResolver) ResolvePath(pkgpath string) Package
type Package ¶
type Package interface { // Should return the package path Path() string // Should return the name of the package as defined at the top level of each file Name() string // Should return all gno filenames inside the package Files() []string // Should return a content reader for the given filename within the package Read(filename string) (io.ReadCloser, error) }
func ParsePackage ¶
ParsePackage parses package from the given directory. It will return a nil package if no gno files are found. If a gno.mod is found, it will be used to determine the pkg path. If root is specified, it will be trimmed from the actual given dir to create the pkgpath if no gno.mod is found.
type PackageHandler ¶
PackageHandler is a callback passed to the resolver during package loading. PackageHandler will be called on each package. If no error is passed, that means that the package has been fully loaded. If any handled error is returned from the handler, the package process will immediately stop.
type PackageReadWalkFunc ¶
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
func NewProcessor ¶
func (*Processor) FormatFile ¶
FormatFile processes a single Gno file from the given file path.
func (*Processor) FormatImportFromSource ¶
FormatImportFromSource parse and format the source from src. The type of the argument for the src parameter must be string, []byte, or io.Reader.