inspector

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package inspector hosts the interfaces which analyses existing go source files and fetches interface commands and variable setup.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AstFile added in v1.1.0

type AstFile struct {
	FileReference *ast.File
	OSFile        File
}

AstFile represents a file node of the ast package

type AstFilter

type AstFilter func(n *ast.Node) bool

AstFilter defines an ast filter type

type AstInterface

type AstInterface struct {
	InterfaceReference *ast.InterfaceType
	Docs               *ast.CommentGroup
	Name               *ast.Ident
	File               *AstFile
}

AstInterface is a simple struct describing an interface

type AstStream

type AstStream struct {
	Nodes   [][]ast.Node
	FileMap []*File
}

AstStream is a stream of nodes that can be inspected and transformed

func NewAstStream

func NewAstStream(fileStream *FileStream) (astStream *AstStream)

NewAstStream creates a new ast stream instance

func (*AstStream) Find

func (a *AstStream) Find() []*AstInterface

Find returns the interfaces declared in the given AstStream

type AstVariable

type AstVariable struct {
	ValueReference *ast.ValueSpec
	Docs           *ast.CommentGroup
}

AstVariable is a variable that represents a variable

type File

type File struct {
	FileInfo os.FileInfo
	Path     string
}

File is a struct containing the reference to a file as well as it's info

type FileStream

type FileStream struct {
	Files []File
}

FileStream defines a stream of files based on a provided file supplier

func NewFileStream

func NewFileStream(path string) (stream *FileStream, e error)

NewFileStream creates a new file stream based on the provided paths

func (*FileStream) Count

func (f *FileStream) Count() (count int)

Count returns the count

func (*FileStream) Filter

func (f *FileStream) Filter(filter func(file File) bool) *FileStream

Filter filters the file stream and removes all files that don't match the filter

func (*FileStream) ForEach

func (f *FileStream) ForEach(consumer func(file File))

ForEach executes the consumer for each file in the stream

Jump to

Keyboard shortcuts

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