gopkg

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrIgnore error
	ErrIgnore = errors.New("ignore empty exported package")
	// ErrInvalidPkgPath error
	ErrInvalidPkgPath = errors.New("invalid package path")
)

Functions

func Export

func Export(pkgPath string, w io.Writer) (err error)

Export utility

func ExportPackage

func ExportPackage(pkg *types.Package, w io.Writer) (err error)

ExportPackage export types.Package to io.Writer

func GoPlusRoot added in v0.7.2

func GoPlusRoot() (root string, err error)

GoPlusRoot returns Go+ root path.

func Import

func Import(pkgPath string) (*types.Package, error)

Import imports a Go package.

func ImportSource added in v0.7.3

func ImportSource(pkgPath string, srcDir string) (*types.Package, error)

ImportSource import a Go package from pkgPath and srcDir

func LookupMod added in v0.7.3

func LookupMod(pkgPath string) (srcDir string, err error)

LookupMod looup pkgPath srcDir from GOMOD root github.com/qiniu/x/log github.com/qiniu/x@v1.11.5/log

func ParsePkgVer added in v0.7.4

func ParsePkgVer(pkgPath string) (pkg string, mod string, sub string)

ParsePkgVer github.com/qiniu/x@v1.11.5/log => github.com/qiniu/x/@v1.11.5 github.com/qiniu/x/log log

Types

type Exporter

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

Exporter represents a go package exporter.

func NewExporter

func NewExporter(w io.Writer, pkg *types.Package) *Exporter

NewExporter creates a go package exporter.

func (*Exporter) Close

func (p *Exporter) Close() error

Close finishes go package export.

func (*Exporter) ExportConst

func (p *Exporter) ExportConst(typ *types.Const) error

ExportConst exports a go const.

func (*Exporter) ExportFunc

func (p *Exporter) ExportFunc(fn *types.Func) error

ExportFunc exports a go function/method.

func (*Exporter) ExportVar

func (p *Exporter) ExportVar(typ *types.Var)

ExportVar exports a go var.

func (*Exporter) IsEmpty

func (p *Exporter) IsEmpty() bool

IsEmpty checks if there is nothing to exmport or not.

Jump to

Keyboard shortcuts

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