Documentation ¶
Overview ¶
Package ast ... TODO package overview docs
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrGoPathUndefined = fmt.Errorf("%s $GOPATH is undefined", errorPrefix) ErrNonExistantSearchPath = func(path string) error { return fmt.Errorf("%s Search path '%s' does not exist", errorPrefix, path) } ErrNonExistantJSONStruct = func(importPath string, structName string) error { return fmt.Errorf("%s Could not find JSON struct spec for %s.%s{}", errorPrefix, importPath, structName) } )
Functions ¶
This section is empty.
Types ¶
type FileSystemWalker ¶
type WalkFunc func(path string, info os.FileInfo, err error) error
type JSONStructFinder ¶
type JSONStructFinder struct { // FileSystemWalker implements a Walk method which recursively traverses // directories looking for structs FileSystemWalker // WalkFunc is the callback which is passed every file discovered by the // FileSystemWalker filepath.WalkFunc *token.FileSet // contains filtered or unexported fields }
JSONStructFinder recursively scans all directories starting at RootDir looking for go files and then traversing their AST in search of structs with json tags eligible for generating json encoders
func NewJSONStructFinder ¶
func NewJSONStructFinder() *JSONStructFinder
func (*JSONStructFinder) FindInAST ¶
func (s *JSONStructFinder) FindInAST(fileNode *ast.File) []StructTypeSpec
func (*JSONStructFinder) FindInDir ¶
func (s *JSONStructFinder) FindInDir(rootDir string) error
func (*JSONStructFinder) StructDirectories ¶
func (s *JSONStructFinder) StructDirectories() []StructDirectory
func (*JSONStructFinder) StructTypeSpecs ¶
func (s *JSONStructFinder) StructTypeSpecs() []StructTypeSpec
type StructDirectory ¶
type StructTypeSpec ¶
func FindJSONStructFor ¶
func FindJSONStructFor(importPath string, name string) (*StructTypeSpec, error)
func (*StructTypeSpec) Name ¶
func (s *StructTypeSpec) Name() string
Click to show internal directories.
Click to hide internal directories.