Documentation ¶
Index ¶
- func ExtractStringLiteral(expr ast.Expr) (string, ast.Node)
- type Context
- func (c *Context) BuildPackages()
- func (c *Context) GetComments(pkg *packages.Package, nodes ...ast.Node) []string
- func (c *Context) GetLocalizeTypeToken(expr ast.Expr) etype.Token
- func (c *Context) GetPosition(pos token.Pos) token.Position
- func (c *Context) GetType(ident *ast.Ident) (*packages.Package, types.Object)
- func (c *Context) SearchIdent(start ast.Node) *ast.Ident
- func (c *Context) SearchIdentAndToken(start ast.Node) (etype.Token, *ast.Ident)
- func (c *Context) SearchStrings(startExpr ast.Expr) []*SearchResult
- type Definition
- type DefinitionType
- type Definitions
- type Extractor
- type SearchResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
type Context struct { Config *config.Config Log *log.Entry OriginalPackages []*packages.Package Packages map[string]*packages.Package Inspector *inspector.Inspector CommentMaps map[string]map[string]ast.CommentMap // pkg -> file -> node -> comments Definitions Definitions Templates []*tmpl.Template }
func (*Context) BuildPackages ¶
func (c *Context) BuildPackages()
func (*Context) GetComments ¶
GetComments extracts the Go comments for a list of nodes.
func (*Context) GetLocalizeTypeToken ¶
func (*Context) SearchIdent ¶ added in v0.3.0
func (*Context) SearchIdentAndToken ¶
func (*Context) SearchStrings ¶ added in v0.6.0
func (c *Context) SearchStrings(startExpr ast.Expr) []*SearchResult
type Definition ¶
type Definition struct { Type DefinitionType Token etype.Token Pck *packages.Package Ident *ast.Ident Path string // github.com/name/repo/package/pack ID string // github.com/name/repo/package/pack.StructName Obj types.Object // only for functions and structs FieldIdent *ast.Ident FieldName string IsVariadic bool // functions only FieldPos int }
func (*Definition) Key ¶
func (d *Definition) Key() string
type DefinitionType ¶
type DefinitionType int
const ( VarSingular DefinitionType = iota Array FunctionReturn FunctionParam StructField )
type Definitions ¶
type Definitions map[string]map[string]*Definition // path.name -> field || "" -> Definition
func (Definitions) Get ¶
func (defs Definitions) Get(key, fieldName string) *Definition
func (Definitions) GetFields ¶
func (defs Definitions) GetFields(key string) map[string]*Definition
type SearchResult ¶ added in v0.6.0
Click to show internal directories.
Click to hide internal directories.