Documentation ¶
Index ¶
Constants ¶
View Source
const GoModuleSupported bool = true
Variables ¶
This section is empty.
Functions ¶
func GoGenerateMain ¶
GoGenerateMain allows gomacro to be run under go generate. It is used to write new x_package.go import bindings for a package. Thus `go generate` will automatically update your bindings.
To use, add a comment to one go file in your package:
`//go:generate gomacro -g .`
to import the current dir; or one like
`//go:generate gomacro -g github.com/lifepod-solutions/gomacro/classic`
to specify the exact import path. The second, specific form, may be necessary if we cannot detect the GOPATH environment variable.
Types ¶
type ImportMode ¶
type ImportMode int
const ( // ImBuiltin import mechanism is: // 1. write a file $GOPATH/src/github.com/lifepod-solutions/gomacro/imports/$PKGPATH.go containing a single func init() // i.e. *inside* gomacro sources // 2. tell the user to recompile gomacro ImBuiltin ImportMode = iota // ImThirdParty import mechanism is the same as ImBuiltin, except that files are created in a thirdparty/ subdirectory: // 1. write a file $GOPATH/src/github.com/lifepod-solutions/gomacro/imports/thirdparty/$PKGPATH.go containing a single func init() // i.e. *inside* gomacro sources // 2. tell the user to recompile gomacro ImThirdParty // ImInception import mechanism is: // 1. write a file $GOPATH/src/$PKGPATH/x_package.go containing a single func init() // i.e. *inside* the package to be imported // 2. tell the user to recompile $PKGPATH ImInception // ImPlugin import mechanism is: // 1. write a file $GOPATH/src/gomacro.imports/$PKGPATH/$PKGNAME.go containing a var Packages map[string]Package // and a single func init() to populate it // 2. invoke "go build -buildmode=plugin" on the file to create a shared library // 3. load such shared library with plugin.Open().Lookup("Packages") ImPlugin )
type Importer ¶
type Importer struct { PluginOpen r.Value // = reflect.ValueOf(plugin.Open) // contains filtered or unexported fields }
func DefaultImporter ¶
func (*Importer) ImportPackage ¶
func (imp *Importer) ImportPackage(alias, path string, enableModule bool) *PackageRef
func (*Importer) ImportPackageOrError ¶
func (imp *Importer) ImportPackageOrError(alias, pkgpath string, enableModule bool) (*PackageRef, error)
type PackageRef ¶
func LookupPackage ¶
func LookupPackage(alias, path string) *PackageRef
LookupPackage returns a package if already present in cache
func (*PackageRef) DefaultName ¶
func (ref *PackageRef) DefaultName() string
func (*PackageRef) String ¶
func (ref *PackageRef) String() string
type TypeVisitor ¶
Click to show internal directories.
Click to hide internal directories.