Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildInfo ¶
type BuildInfo interface {
// Read reads the build info from the given path.
Read(path string) (*buildinfo.BuildInfo, error)
}
BuildInfo is the interface for reading build info.
type CleanupFunc ¶
type CleanupFunc func() error
CleanupFunc is a function that cleans up a resource.
type Environment ¶
Environment is the interface for the environment.
type Exec ¶
type Exec interface {
Run(ctx context.Context, name string, args ...string) ExecRun
CombinedOutput(ctx context.Context, name string, args ...string) ExecCombinedOutput
}
Exec is the interface for creating commands to be executed.
type ExecCombinedOutput ¶
ExecCombinedOutput is an interface that represents a command that can be run and returns the combined output.
func NewExecCombinedOutput ¶
func NewExecCombinedOutput( ctx context.Context, name string, args ...string, ) ExecCombinedOutput
NewExecCombinedOutput creates a new ExecCombinedOutput that runs a command. It uses the exec package to run the command, injecting the environment variables from the current process.
type ExecRun ¶
ExecRun is an interface that represents a command that can be run and inject environment variables.
type FileSystem ¶
type FileSystem interface {
// CreateDir creates a directory with the given path and permissions.
CreateDir(path string, perm os.FileMode) error
// CreateTempDir creates a temporary directory with the given path and pattern.
CreateTempDir(dir, pattern string) (string, CleanupFunc, error)
// IsSymlinkToDir checks if a path is a symlink to another directory.
IsSymlinkToDir(path string, baseDir string) (bool, error)
// ListBinaries lists the binaries in a directory.
ListBinaries(path string) ([]string, error)
// LocateBinaryInPath locates a binary in the PATH environment variable.
LocateBinaryInPath(name string) []string
// Move moves a file or directory.
Move(source, target string) error
// MoveWithSymlink moves a file and creates a symlink to the original file.
MoveWithSymlink(source, target string) error
// Remove removes a file or directory.
Remove(path string) error
// ReplaceSymlink replaces a symlink with a new source.
ReplaceSymlink(source, target string) error
// GetSymlinkTarget gets the target of a symlink.
GetSymlinkTarget(path string) (string, error)
}
FileSystem is the interface for the file system.
type Resource ¶
type Resource interface {
// Open opens a resource using the default system tools.
Open(ctx context.Context, resource string) error
}
Resource is the interface for handling resources.
func NewResource ¶
NewResource creates a new Resource.
type Runtime ¶
type Runtime interface {
// OS returns the operating system.
OS() string
// Platform returns the platform in the format "os/arch".
Platform() string
// Version returns the version.
Version() string
}
Runtime is the interface for the runtime.
type Workspace ¶
type Workspace interface {
// GetGoBinPath returns the Go binary path.
GetGoBinPath() string
// GetInternalBasePath returns the internal base directory.
GetInternalBasePath() string
// GetInternalBinPath returns the internal binary directory.
GetInternalBinPath() string
// GetInternalTempPath returns the internal temporary directory.
GetInternalTempPath() string
// Initialize initializes the workspace.
Initialize() error
}
Workspace is an interface that provides methods to interact with the workspace.
func NewWorkspace ¶
func NewWorkspace( env Environment, fs FileSystem, runtime Runtime, ) (Workspace, error)
NewWorkspace creates a new workspace. It returns an error if the workspace initialization fails.