goasthelper

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AstFile

type AstFile struct {
	Path     string // from user
	FilePath string // path for file
	AstNode  *ast.File
}

path and file path may different if user give folder instead of file path

func ParseGoFiles

func ParseGoFiles(paths []string) (astFiles []AstFile, err error)

type GoAstHelper

type GoAstHelper[Resp any] struct {
	Path   []string                                              // 2 type, first is point to file directly, for example a/b/c/d.go, second is point to folder, only need to show last folder, for example a/b/c
	Action func(path string, n ast.Node) (resp *Resp, next bool) // true mean skip
}

func GetNewGoAstHelper

func GetNewGoAstHelper[Resp any](path []string, action func(path string, n ast.Node) (resp *Resp, next bool)) (goAstHelper GoAstHelper[Resp])

func (*GoAstHelper[Resp]) Run

func (a *GoAstHelper[Resp]) Run() (resps []Resp, err error)

func (*GoAstHelper[Resp]) RunAndReturnByFilePath

func (a *GoAstHelper[Resp]) RunAndReturnByFilePath() (resps map[string]Resp, err error)

func (*GoAstHelper[Resp]) RunAndReturnByPath

func (a *GoAstHelper[Resp]) RunAndReturnByPath() (resps map[string][]Resp, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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