sandbox: rename params struct
All checks were successful
Test / Create distribution (push) Successful in 25s
Test / Fortify (push) Successful in 2m33s
Test / Fpkg (push) Successful in 3m27s
Test / Data race detector (push) Successful in 4m3s
Test / Flake checks (push) Successful in 59s

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-03-17 21:45:08 +09:00
parent 7c063833e0
commit d7eddd54a2
3 changed files with 14 additions and 13 deletions

View File

@@ -54,7 +54,6 @@ type (
// with behaviour identical to its [exec.Cmd] counterpart.
ExtraFiles []*os.File
InitParams
// Custom [exec.Cmd] initialisation function.
CommandContext func(ctx context.Context) (cmd *exec.Cmd)
@@ -72,9 +71,11 @@ type (
cmd *exec.Cmd
ctx context.Context
Params
}
InitParams struct {
// Params holds container configuration and is safe to serialise.
Params struct {
// Working directory in the container.
Dir string
// Initial process environment.
@@ -100,7 +101,7 @@ type (
Ops []Op
Op interface {
apply(params *InitParams) error
apply(params *Params) error
prefix() string
Is(op Op) bool
@@ -210,7 +211,7 @@ func (p *Container) Serve() error {
p.setup = nil
return setup.Encode(
&initParams{
p.InitParams,
p.Params,
syscall.Getuid(),
syscall.Getgid(),
len(p.ExtraFiles),
@@ -228,6 +229,6 @@ func (p *Container) String() string {
func New(ctx context.Context, name string, args ...string) *Container {
return &Container{name: name, ctx: ctx,
InitParams: InitParams{Args: append([]string{name}, args...), Dir: "/", Ops: new(Ops)},
Params: Params{Args: append([]string{name}, args...), Dir: "/", Ops: new(Ops)},
}
}