syntree

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileWrapper

type FileWrapper struct {
	// contains filtered or unexported fields
}

FileWrapper is a wrapper around the ast.File struct that provides convenience methods.

func WrapFile

func WrapFile(file *ast.File) *FileWrapper

WrapFile creates a new FileWrapper instance based on an ast.File struct.

func (*FileWrapper) FindPackagePathByName

func (w *FileWrapper) FindPackagePathByName(name string) (string, error)

FindPackagePathByName searches the file's import statements for a package with the specified name and returns its path.

func (*FileWrapper) Imports

func (w *FileWrapper) Imports() []*importWrapper

Imports returns a slice of importWrapper instances representing the file's import statements.

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

Scanner is a struct that contains a fileset and is used to scan directories for Go files.

func NewScanner

func NewScanner(fset *token.FileSet) *Scanner

NewScanner creates a new instance of Scanner.

func (*Scanner) ScanDirectory

func (s *Scanner) ScanDirectory(directory string) (map[string]*ast.File, error)

ScanDirectory scans a directory for Go files and returns a map with the file names as keys and the corresponding AST nodes as values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL