plugin

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2019 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gofmt

func Gofmt(src []byte) ([]byte, error)

Gofmt formats Go source code.

func GofmtReadWriter

func GofmtReadWriter(rw io.ReadWriter) (io.ReadWriter, error)

GofmtReadWriter formats an io.ReadWriter, such as an *os.File.

Types

type Func

type Func func(d *collector.Data) error

Func is a function which defines plugin behavior, and is provided a pointer to collector.Data.

type Plugin

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

func New

func New(name string) *Plugin

New returns a Plugin instance for a Plugin to be initialized.

func (*Plugin) Init

func (p *Plugin) Init(fn Func)

Init is called by Plugin code and is provided a PluginFunc from the caller to handle the input Data (read from stdin).

func (*Plugin) OutputTemplate

func (p *Plugin) OutputTemplate(dst io.Writer, templatePath string, data interface{}) error

OutputTemplate executes a text template using the provided data and writes it to the destination io.Writer.

func (*Plugin) OutputTemplateHTML

func (p *Plugin) OutputTemplateHTML(dst io.Writer, templatePath string, data interface{}) error

OutputTemplateHTML executes an HTML template using the provided data and writes it to the destination io.Writer.

Jump to

Keyboard shortcuts

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