Help us shape the future of Go! Take the 2026 Go Developer Survey

plugin

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Concat

func Concat(pluginArgs [][2]string) string

Concat joins the given array of key=value formatted strings into a single ; delimited string.

func DownloadPlugin

func DownloadPlugin(source PluginSource, targetPath string) error

func FindInPaths

func FindInPaths(plugin string, paths []string) (string, error)

FindInPaths returns the full path of the plugin executable by searching in the provided list of paths

func MergeDuplicateEnviron

func MergeDuplicateEnviron(env []string) []string

MergeDuplicateEnviron returns a copy of environment variables with any duplicates removed, and keeping the latest values. Only variables of format "key=value" are considered for merging.

func ParseInputArgs

func ParseInputArgs(args string) ([][2]string, error)

ParseInputArgs parses the given string into an array of key=value formatted strings.

Types

type DefaultExecutor

type DefaultExecutor struct {
	Stderr io.Writer
}

DefaultExecutor finds the plugin executable and invokes it as a os command

func (*DefaultExecutor) ExecutePlugin

func (e *DefaultExecutor) ExecutePlugin(ctx context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error)

return the command output and the error

func (*DefaultExecutor) FindInPaths

func (e *DefaultExecutor) FindInPaths(plugin string, paths []string) (string, error)

type Error

type Error struct {
	Code    uint   `json:"code"`
	Msg     string `json:"msg"`
	Details string `json:"details,omitempty"`
}

Error describes an error during plugin execution

func NewError

func NewError(code uint, msg, details string) *Error

NewError creates new Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Print

func (e *Error) Print() error

type Executor

type Executor interface {
	// ExecutePlugin executes the plugin with the given parameters
	ExecutePlugin(ctx context.Context, pluginPath string, cmdArgs []string, stdinData []byte, environ []string) ([]byte, error)
	// FindInPaths finds the plugin in the given paths
	FindInPaths(plugin string, paths []string) (string, error)
}

Executor is an interface that defines methods to lookup a plugin and execute it.

type PluginArgs

type PluginArgs interface {
	AsEnviron() []string
}

type PluginSource

type PluginSource struct {
	Artifact     string                          `json:"artifact"`
	AuthProvider authprovider.AuthProviderConfig `json:"authProvider,omitempty"`
}

func ParsePluginSource

func ParsePluginSource(source interface{}) (PluginSource, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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