exports

package
v43.2.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Const

type Const struct {
	// the type of the constant
	Type string `json:"type"`

	// the value of the constant
	Value string `json:"value"`
}

Const is a const definition.

type Content

type Content struct {
	// the list of exported constants.
	// key is the exported name, value is its type and value.
	Consts map[string]Const `json:"consts,omitempty"`

	// the list of exported functions and methods.
	// key is the exported name, for methods it's prefixed with the receiver type (e.g. "Type.Method").
	// value contains the list of params and return types.
	Funcs map[string]Func `json:"funcs,omitempty"`

	// the list of exported interfaces.
	// key is the exported name, value contains the interface definition.
	Interfaces map[string]Interface `json:"interfaces,omitempty"`

	// the list of exported struct types.
	// key is the exported name, value contains field information.
	Structs map[string]Struct `json:"structs,omitempty"`
}

Content defines the set of exported constants, funcs, and structs.

func Get

func Get(pkgDir string) (Content, error)

Get loads the package in the specified directory and returns the exported content. It's a convenience wrapper around LoadPackage() and GetExports().

func NewContent

func NewContent() Content

NewContent returns an initialized Content object.

func (Content) IsEmpty

func (c Content) IsEmpty() bool

IsEmpty returns true if there is no content in any of the fields.

type Func

type Func struct {
	// a comma-delimited list of the param types
	Params *string `json:"params,omitempty"`

	// a comma-delimited list of the return types
	Returns *string `json:"returns,omitempty"`
}

Func contains parameter and return types of a function/method.

type Interface

type Interface struct {
	Methods map[string]Func
}

Interface contains the list of methods for an interface.

type LoadPackageErrorInfo

type LoadPackageErrorInfo interface {
	PkgCount() int
}

LoadPackageErrorInfo provides extended information about certain LoadPackage() failures.

type Package

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

Package represents a Go package.

func LoadPackage

func LoadPackage(dir string) (pkg Package, err error)

LoadPackage loads the package in the specified directory. It's required there is only one package in the directory.

func (Package) GetExports

func (pkg Package) GetExports() (c Content)

GetExports returns the exported content of the package.

func (Package) Name

func (pkg Package) Name() string

Name returns the package name.

type Struct

type Struct struct {
	// a list of anonymous fields
	AnonymousFields []string `json:"anon,omitempty"`

	// key/value pairs of the field names and types respectively.
	Fields map[string]string `json:"fields,omitempty"`
}

Struct contains field info about a struct.

Jump to

Keyboard shortcuts

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