golang

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotExported = errors.New("type is not exported")
)

Functions

func ConstFromValueSpec

func ConstFromValueSpec(spec *ast.ValueSpec) (*reader.Constant, error)

func ParseInterface

func ParseInterface(spec *ast.TypeSpec) (*reader.Interface, error)

Parse Go interface from ast.TypeSpec

func ParseStruct

func ParseStruct(spec *ast.TypeSpec) (*reader.Interface, error)

func ParseTypeAlias

func ParseTypeAlias(spec *ast.TypeSpec) *reader.TypeAlias

Parse Go type alias

func TypeFromExpr

func TypeFromExpr(t ast.Expr) *reader.Type

Parses ast.Expr and returns a Type

func TypeFromName

func TypeFromName(n string) *reader.Type

Returns a Type with the given name

func TypeFromToken

func TypeFromToken(t token.Token) *reader.Type

Returns a type with the token's string representation as the name

Types

type Import

type Import struct {
	// Package path
	//
	// This might not be populated immediately
	// since we need access to the file imports to find the path
	Package string `json:"package"`

	// Name of import
	//
	// Might be alias or real package name
	Name string `json:"alias"`
}

Package import options

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func (*Reader) Packages

func (r *Reader) Packages() []*reader.Package

func (*Reader) Read

func (r *Reader) Read(rc *reader.ReadConfig) error

Jump to

Keyboard shortcuts

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