Back to godoc.org

Package appprotoexec

v0.20.5
Latest Go to latest

The latest major version is .

Published: Jul 24, 2020 | License: Apache-2.0 | Module: github.com/bufbuild/buf

Overview

Package appprotoexec provides appproto.Handlers for binary plugins.

Index

Constants

const (
	// DefaultMajorVersion is the default major version.
	DefaultMajorVersion = 3
	// DefaultMinorVersion is the default minor version.
	DefaultMinorVersion = 12
	// DefaultPatchVersion is the default patch version.
	DefaultPatchVersion = 3
	// DefaultSuffixVersion is the default suffix version.
	DefaultSuffixVersion = ""
)

Variables

var (
	// ProtocProxyPluginNames are the names of the plugins that should be proxied through protoc
	// in the absense of a binary.
	ProtocProxyPluginNames = map[string]struct{}{
		"cpp":    {},
		"csharp": {},
		"java":   {},
		"js":     {},
		"objc":   {},
		"php":    {},
		"python": {},
		"ruby":   {},
	}
)

func NewBinaryHandler

func NewBinaryHandler(
	logger *zap.Logger,
	pluginPath string,
) (appproto.Handler, error)

NewBinaryHandler returns a new Handler for the given plugin path.

exec.LookPath is called on the pluginPath, and error is returned if exec.LookPath returns an error.

func NewHandler

func NewHandler(
	logger *zap.Logger,
	pluginName string,
	protocPath string,
	pluginPath string,
) (appproto.Handler, error)

NewHandler returns a new Handler based on the plugin name and optional path.

protocPath and pluginPath are optional.

- If the plugin path is set, this returns a new binary handler for that path. - If the plugin path is unset, this does exec.LookPath for a binary named protoc-gen-pluginName,

and if one is found, a new binary handler is returned for this.

- Else, if the name is in ProtocProxyPluginNames, this returns a new protoc proxy handler. - Else, this returns error.

func NewProtocProxyHandler

func NewProtocProxyHandler(
	logger *zap.Logger,
	protocPath string,
	pluginName string,
) (appproto.Handler, error)

NewProtocProxyHandler returns a new Handler that proxies through protoc.

This can be used for the builtin plugins.

exec.LookPath is called on the protocPath, and error is returned if exec.LookPath returns an error.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier