From b4e9f148ecb657ca6ca192fc3bc3bba1ca5b4412 Mon Sep 17 00:00:00 2001 From: Nuno Cruces Date: Tue, 13 Aug 2024 23:47:21 +0100 Subject: [PATCH] TODOs Signed-off-by: Nuno Cruces --- internal/wasm/store.go | 11 ++++++----- sys/stat_unsupported.go | 3 --- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/internal/wasm/store.go b/internal/wasm/store.go index cf87c30ea7..dda6e5b635 100644 --- a/internal/wasm/store.go +++ b/internal/wasm/store.go @@ -3,6 +3,7 @@ package wasm import ( "context" "encoding/binary" + "errors" "fmt" "sync" "sync/atomic" @@ -659,20 +660,20 @@ func (s *Store) GetFunctionTypeID(t *FunctionType) (FunctionTypeID, error) { } // CloseWithExitCode implements the same method as documented on wazero.Runtime. -func (s *Store) CloseWithExitCode(ctx context.Context, exitCode uint32) (err error) { +func (s *Store) CloseWithExitCode(ctx context.Context, exitCode uint32) error { s.mux.Lock() defer s.mux.Unlock() // Close modules in reverse initialization order. + var errs []error for m := s.moduleList; m != nil; m = m.next { // If closing this module errs, proceed anyway to close the others. - if e := m.closeWithExitCode(ctx, exitCode); e != nil && err == nil { - // TODO: use multiple errors handling in Go 1.20. - err = e // first error + if err := m.closeWithExitCode(ctx, exitCode); err != nil { + errs = append(errs, err) } } s.moduleList = nil s.nameToModule = nil s.nameToModuleCap = 0 s.typeIDs = nil - return + return errors.Join(errs...) } diff --git a/sys/stat_unsupported.go b/sys/stat_unsupported.go index 583c2adb04..cc37012cff 100644 --- a/sys/stat_unsupported.go +++ b/sys/stat_unsupported.go @@ -7,9 +7,6 @@ import "io/fs" // sysParseable is only used here as we define "supported" as being able to // parse `info.Sys()`. The above `go:build` constraints exclude 32-bit until // that's requested. -// -// TODO: When Go 1.21 is out, use the "unix" build constraint (as 1.21 makes -// our floor Go version 1.19. const sysParseable = false func statFromFileInfo(info fs.FileInfo) Stat_t {