From a1e5f020f48a65138c900961f856cf6b04833770 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 27 Jul 2025 12:17:21 +0900 Subject: container: improve doc comments Putting them on the builder methods is more useful. Signed-off-by: Ophestra --- container/container.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'container/container.go') diff --git a/container/container.go b/container/container.go index a10e610f..0b6891b9 100644 --- a/container/container.go +++ b/container/container.go @@ -91,12 +91,13 @@ type ( } ) +// Start starts the container init. The init process blocks until Serve is called. func (p *Container) Start() error { if p.cmd != nil { - return errors.New("sandbox: already started") + return errors.New("container: already started") } if p.Ops == nil || len(*p.Ops) == 0 { - return errors.New("sandbox: starting an empty container") + return errors.New("container: starting an empty container") } ctx, cancel := context.WithCancel(p.ctx) @@ -160,6 +161,8 @@ func (p *Container) Start() error { return nil } +// Serve serves [Container.Params] to the container init. +// Serve must only be called once. func (p *Container) Serve() error { if p.setup == nil { panic("invalid serve") @@ -213,6 +216,7 @@ func (p *Container) Serve() error { return err } +// Wait waits for the container init process to exit. func (p *Container) Wait() error { defer p.cancel(); return p.cmd.Wait() } func (p *Container) String() string { -- cgit v1.3.1