plugs

package module
v0.0.0-...-6c3d093 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2016 License: BSD-3-Clause Imports: 7 Imported by: 0

README

plugs

plugs is a simple WIP package to ease the process of building Go plugins.

A simple usage looks like the following:

p, err := plugs.Open("github.com/sbinet/plugs/testdata/p1")
if err != nil {
	panic(err)
}
v, err := p.Lookup("V")
f, err := p.Lookup("F")
*v.(*int) = 7
f.(func() string)() // returns "Hello, number 7"

plugs will invoke the Go compiler toolchain (via go build -buildmode=plugin) before trying to load the *plugin.Plugin via the plugin module.

Documentation

Overview

Package plugs provides an API to compile and open plugins.

A simple usage looks like the following:

p, err := plugs.Open("github.com/sbinet/plugs/testdata/p1")
if err != nil {
    panic(err)
}
v, err := p.Lookup("V")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(pkg string) (*plugin.Plugin, error)

Open compiles and opens a Go plugin. If a package path has already been successfully compiled and opened, then the existing *plugin.Plugin is returned.

It is safe for concurrent use by multiple goroutines.

Types

This section is empty.

Jump to

Keyboard shortcuts

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