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

mock

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

type Executor struct {
	ExecuteInvoked bool
	ExecuteFn      func(context.Context, string, ...string) ([]byte, error)

	ExecuteSplitInvoked bool
	ExecuteSplitFn      func(context.Context, string, ...string) (stdout, stderr []byte, err error)
}

Executor is a mock implementation of the command executor interface. It implements the same interface as mcp.Executor through structural typing.

func NewExecutor

func NewExecutor() *Executor

NewExecutor creates a new mock executor

func (*Executor) Execute

func (m *Executor) Execute(ctx context.Context, subcommand string, args ...string) ([]byte, error)

Execute implements the executor interface, recording invocation details and delegating to ExecuteFn if provided.

func (*Executor) ExecuteSplit added in v0.51.0

func (m *Executor) ExecuteSplit(ctx context.Context, subcommand string, args ...string) ([]byte, []byte, error)

ExecuteSplit implements the executor interface, recording invocation details and delegating to ExecuteSplitFn if provided.

type ProcessStarter added in v0.51.0

type ProcessStarter struct {
	StartInvoked bool
	StartFn      func(ctx context.Context, subcommand string, args ...string) (pid int, host, port string, stop func() error, err error)
}

ProcessStarter is a mock implementation of the process-starter interface used by the "run" tool. It avoids spawning real subprocesses in tests. It implements the same interface as mcp.processStarter through structural typing.

func NewProcessStarter added in v0.51.0

func NewProcessStarter() *ProcessStarter

NewProcessStarter creates a new mock process starter.

func (*ProcessStarter) Start added in v0.51.0

func (m *ProcessStarter) Start(ctx context.Context, subcommand string, args ...string) (pid int, host, port string, stop func() error, err error)

Start implements the processStarter interface, recording invocation details and delegating to StartFn if provided.

Jump to

Keyboard shortcuts

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