{"modulePath":"github.com/uber/submitqueue","version":"v0.3.0-20261125210437-add1a4bd2ea2","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package gitworkspace\n\nPackage gitworkspace defines the pluggable interface for executing git commands in a stateful workspace. The OSS implementation runs commands as local subprocesses; alternative deployments wrap their backend's exec API in the same contract.\n\n## Functions\n\n```go\nfunc CommandFailure(ctx context.Context, cmd Command, out Output) error\n```\nCommandFailure builds the error for a command that exited non-zero, in the form the git error classifier recognises. The diagnostic keeps all of stderr and stdout, since a classifying fragment can sit behind advice text. An ended ctx takes precedence, so a command killed by cancellation reads as cancellation rather than as a git failure.\n\n## Types\n\n```go\ntype Command struct {\n\t// Alias identifies this command's Output in the response. It must be unique\n\t// within one Exec batch.\n\tAlias string\n\t// Bin is the executable name, such as \"git\". The backend decides which\n\t// binary it resolves to.\n\tBin string\n\t// Args are the command-line arguments. For git, Args[0] is the subcommand;\n\t// global options and identity belong to the backend, not here.\n\tArgs []string\n\t// Stdin is optional standard input.\n\tStdin string\n}\n```\nCommand is one command to execute in a git workspace.\n\n```go\ntype Factory interface {\n\t// For returns a Workspace for the given repository. Cancelling ctx aborts\n\t// any running command and ends the Workspace, so ctx bounds its lifetime.\n\tFor(ctx context.Context, repo string) (Workspace, error)\n}\n```\nFactory creates Workspace instances bound to a repository.\n\n```go\ntype Output struct {\n\t// Alias matches the Command that produced this output.\n\tAlias string\n\t// ExitCode is the process exit code. It is unspecified when Skipped is set.\n\tExitCode int32\n\t// Skipped reports that the command did not run because an earlier command\n\t// in the same batch failed.\n\tSkipped bool\n\t// Stdout is the captured standard output.\n\tStdout string\n\t// Stderr is the captured standard error.\n\tStderr string\n}\n```\nOutput is the result of one executed command.\n\n```go\ntype Workspace interface {\n\t// Exec runs a batch and returns one Output per command, in order. A\n\t// command that exits non-zero is reported in its Output, not as an error;\n\t// the error is reserved for failing to run the batch at all.\n\tExec(commands []Command) ([]Output, error)\n\t// Close releases the workspace and its resources.\n\tClose() error\n}\n```\nWorkspace is a stateful git environment where command batches execute sequentially. Commands within one Exec call run in order; after the first non-zero exit, every remaining command is reported Skipped. State persists across Exec calls on the same Workspace. A Workspace is used by one goroutine at a time.\n\n","path":"github.com/uber/submitqueue/platform/extension/gitworkspace","name":"gitworkspace","synopsis":"Package gitworkspace defines the pluggable interface for executing git commands in a stateful workspace.","isRedistributable":true}
