aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/params.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-04-07 16:31:46 +0900
committerOphestra <cat@gensokyo.uk>2026-04-07 16:37:44 +0900
commitc61cdc505f05decd940cb2d861241039a49251e3 (patch)
treee6f34ad86c7a4d0e98b896cd37d4f77cbcb9ea66 /container/params.go
parent062edb3487c1cc116cae78bf77420b65c43517d1 (diff)
internal/params: relocate from package container
This does not make sense as part of the public API, so make it internal. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/params.go')
-rw-r--r--container/params.go36
1 files changed, 0 insertions, 36 deletions
diff --git a/container/params.go b/container/params.go
deleted file mode 100644
index e6cd26f8..00000000
--- a/container/params.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package container
-
-import (
- "encoding/gob"
- "errors"
- "os"
- "strconv"
- "syscall"
-)
-
-var (
- ErrReceiveEnv = errors.New("environment variable not set")
-)
-
-// Receive retrieves setup fd from the environment and receives params.
-func Receive(key string, e any, fdp *uintptr) (func() error, error) {
- var setup *os.File
-
- if s, ok := os.LookupEnv(key); !ok {
- return nil, ErrReceiveEnv
- } else {
- if fd, err := strconv.Atoi(s); err != nil {
- return nil, optionalErrorUnwrap(err)
- } else {
- setup = os.NewFile(uintptr(fd), "setup")
- if setup == nil {
- return nil, syscall.EDOM
- }
- if fdp != nil {
- *fdp = setup.Fd()
- }
- }
- }
-
- return setup.Close, gob.NewDecoder(setup).Decode(e)
-}