Documentation
¶
Index ¶
- Variables
- type Gozero
- type Options
- type Source
- func NewSource() (*Source, error)
- func NewSourceWithBytes(src []byte, wantedPattern, dir string) (*Source, error)
- func NewSourceWithFile(src string) (*Source, error)
- func NewSourceWithReader(src io.Reader, wantedPattern, dir string) (*Source, error)
- func NewSourceWithString(src, wantedPattern, dir string) (*Source, error)
- type VirtualEnvType
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoValidEngine is returned when no valid engine is found ErrNoValidEngine = errors.New("no valid engine found") // ErrNoEngines is returned when no engines are provided ErrNoEngines = errors.New("no engines provided") )
Functions ¶
This section is empty.
Types ¶
type Gozero ¶
type Gozero struct {
Options *Options
}
Gozero is executor for gozero
func (*Gozero) Eval ¶
func (g *Gozero) Eval(ctx context.Context, src, input *Source, args ...string) (*types.Result, error)
Eval evaluates the source code and returns the output input = stdin , src = source code , args = arguments
func (*Gozero) EvalWithVirtualEnv ¶ added in v0.1.1
func (g *Gozero) EvalWithVirtualEnv(ctx context.Context, envType VirtualEnvType, src, input *Source, dockerConfig *sandbox.DockerConfiguration, args ...string) (*types.Result, error)
EvalWithVirtualEnv evaluates the source code in a virtual environment and returns the output. As in Eval, the engine gets Options.Args before the source path and args after it, input is the standard input, and the variables of src and input are environment variables. A source that starts with a shebang runs directly, without the engine and Options.Args.
type Source ¶
type Source struct {
Variables []types.Variable
Temporary bool
CloseAfterWrite bool
Filename string
File *os.File
}
Source is a source file for gozero and is meant to contain i/o for code execution
func NewSourceWithBytes ¶
func NewSourceWithFile ¶
func NewSourceWithReader ¶
func NewSourceWithString ¶
func (*Source) AddVariable ¶
type VirtualEnvType ¶ added in v0.1.1
type VirtualEnvType uint8
VirtualEnvType represents the type of virtual environment
const ( VirtualEnvLinux VirtualEnvType = iota VirtualEnvDarwin VirtualEnvWindows VirtualEnvDocker )
Directories
¶
| Path | Synopsis |
|---|---|
|
cmdexec package is wrapper around os/exec and handles common use cases while executing commands.
|
cmdexec package is wrapper around os/exec and handles common use cases while executing commands. |
|
examples
|
|
|
bubblewrap_sandbox
command
|
|
|
docker_sandbox/bash_source
command
|
|
|
docker_sandbox/python_source
command
|
|
|
docker_sandbox/run_commands
command
|
|
|
simple_darwin
command
|
|
|
simple_linux
command
|
|
|
simple_windows
command
|
|