From 7abc4094011fe7d8fd4bba38f89008217d9bdd47 Mon Sep 17 00:00:00 2001 From: tim Date: Fri, 18 Feb 2022 13:58:28 -0800 Subject: [PATCH 1/2] wasi: env initialization fix Closes #261 Signed-off-by: tim --- wasi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasi.go b/wasi.go index 0403769aba..1113e92acf 100644 --- a/wasi.go +++ b/wasi.go @@ -57,7 +57,7 @@ func WASISnapshotPreview1WithConfig(c *WASIConfig) *HostFunctions { opts = append(opts, opt) } if len(c.Environ) > 0 { - environ := make([]string, len(c.Environ)) + environ := make([]string, 0) for k, v := range c.Environ { environ = append(environ, fmt.Sprintf("%s=%s", k, v)) } From fe465727c348bc1e8d965d2785989073e89178f4 Mon Sep 17 00:00:00 2001 From: Crypt Keeper <64215+codefromthecrypt@users.noreply.github.com> Date: Sat, 19 Feb 2022 07:01:35 +0800 Subject: [PATCH 2/2] Update wasi.go --- wasi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wasi.go b/wasi.go index 1113e92acf..ff69cf78a4 100644 --- a/wasi.go +++ b/wasi.go @@ -57,7 +57,7 @@ func WASISnapshotPreview1WithConfig(c *WASIConfig) *HostFunctions { opts = append(opts, opt) } if len(c.Environ) > 0 { - environ := make([]string, 0) + environ := make([]string, 0, len(c.Environ)) for k, v := range c.Environ { environ = append(environ, fmt.Sprintf("%s=%s", k, v)) }