comments

package module
v0.0.0-...-0cbe903 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: MIT Imports: 8 Imported by: 0

README

comments

go ast comment

// 实现Finder接口
type printFinder struct{}
func (printFinder) Filter(os.FileInfo) bool {  ...  }
func (printFinder) Func(comments FuncComments) error {  ...  }
func (printFinder) Type(comments TypeComments) error {  ...  }
func (printFinder) Field(comments FieldComments) error {  ...  }

// 调用查找注释的方法
_ = comment.Find(dir, true, nil)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AstFind

func AstFind(dir string, all bool, finder Finder) error

Types

type FieldComments

type FieldComments struct {
	TypeComments
	Fields *ast.FieldList
}

type Finder

type Finder interface {
	Filter(os.FileInfo) bool
	Package(PackageComments) error
	Func(FuncComments) error
	Type(TypeComments) error
	Field(FieldComments) error
}

type FuncComments

type FuncComments struct {
	PackageComments
	Func *ast.FuncDecl
}

type PackageComments

type PackageComments struct {
	Filepath string
	Pkg      *ast.Package
	File     *ast.File
}

type TypeComments

type TypeComments struct {
	PackageComments
	Decl *ast.GenDecl
	Type *ast.TypeSpec
}

Jump to

Keyboard shortcuts

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