From d53a1531e6e2038becc428b545cd496c97730d55 Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Tue, 15 Aug 2023 22:10:30 +0200 Subject: [PATCH] chore: update to Go 1.21 --- api.go | 3 +-- context.go | 3 +-- entrypoint.go | 2 +- .../hello_world_go/internal/integration/integration_test.go | 2 +- examples/hello_world_go/module/hello_world.go | 2 +- exec/lookup.go | 5 +++-- executor.go | 3 +-- go.mod | 3 +-- go.sum | 2 -- logger.go | 2 +- protocol/unmarshal.go | 4 +--- registry.go | 1 - state_proxy.go | 3 +-- 13 files changed, 13 insertions(+), 22 deletions(-) diff --git a/api.go b/api.go index dd47c52..c360082 100644 --- a/api.go +++ b/api.go @@ -3,10 +3,9 @@ package sdk import ( "context" "io" + "log/slog" "time" - "golang.org/x/exp/slog" - rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1" ) diff --git a/context.go b/context.go index a1319bf..d41c4a3 100644 --- a/context.go +++ b/context.go @@ -3,9 +3,8 @@ package sdk import ( "context" "io" + "log/slog" "os" - - "golang.org/x/exp/slog" ) var _ ExecutionContext = (*wasiExecutionContext)(nil) diff --git a/entrypoint.go b/entrypoint.go index e9c8873..19c706f 100644 --- a/entrypoint.go +++ b/entrypoint.go @@ -75,7 +75,7 @@ func HelpFor(pecPtr, specSize uint32) uint64 { } modHelp := helper.Help() - var helpResponse = &rpcv1.HelpResponse{ + helpResponse := &rpcv1.HelpResponse{ Name: modHelp.Name, Description: modHelp.Description, Examples: make([]*rpcv1.TaskExample, 0, len(modHelp.Examples)), diff --git a/examples/hello_world_go/internal/integration/integration_test.go b/examples/hello_world_go/internal/integration/integration_test.go index 7546c26..afbc3c8 100644 --- a/examples/hello_world_go/internal/integration/integration_test.go +++ b/examples/hello_world_go/internal/integration/integration_test.go @@ -5,11 +5,11 @@ package integration_test import ( "context" _ "embed" + "log/slog" "os" "testing" "github.com/stretchr/testify/mock" - "golang.org/x/exp/slog" "code.icb4dc0.de/buildr/buildr/modules" mm "hello_world/mocks/modules" diff --git a/examples/hello_world_go/module/hello_world.go b/examples/hello_world_go/module/hello_world.go index ce63bc6..27e03f3 100644 --- a/examples/hello_world_go/module/hello_world.go +++ b/examples/hello_world_go/module/hello_world.go @@ -2,11 +2,11 @@ package module import ( "fmt" + "log/slog" "os" "code.icb4dc0.de/buildr/wasi-module-sdk-go/exec" rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1" - "golang.org/x/exp/slog" sdk "code.icb4dc0.de/buildr/wasi-module-sdk-go" ) diff --git a/exec/lookup.go b/exec/lookup.go index a471d19..756808c 100644 --- a/exec/lookup.go +++ b/exec/lookup.go @@ -1,10 +1,11 @@ package exec import ( - "code.icb4dc0.de/buildr/wasi-module-sdk-go/mem" - rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1" "errors" "fmt" + + "code.icb4dc0.de/buildr/wasi-module-sdk-go/mem" + rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1" ) func LookPath(file string) (string, error) { diff --git a/executor.go b/executor.go index 14cef89..5bc6e72 100644 --- a/executor.go +++ b/executor.go @@ -2,8 +2,7 @@ package sdk import ( "context" - - "golang.org/x/exp/slog" + "log/slog" ) func NewExecutor(repoRoot, outDir, binDir string) Executor { diff --git a/go.mod b/go.mod index bbf450a..1861f14 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,9 @@ module code.icb4dc0.de/buildr/wasi-module-sdk-go -go 1.20 +go 1.21 require ( github.com/tetratelabs/tinymem v0.1.0 - golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 google.golang.org/protobuf v1.31.0 ) diff --git a/go.sum b/go.sum index 45eb815..91ec2cf 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,6 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/tetratelabs/tinymem v0.1.0 h1:Qza1JAg9lquPPJ/CIei5qQYx7t18KLie83O2WR6CM58= github.com/tetratelabs/tinymem v0.1.0/go.mod h1:WFFTZFhLod6lTL+UetFAopVbGaB+KFsVcIY+RUv7NeY= -golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 h1:EDuYyU/MkFXllv9QF9819VlI9a4tzGuCbhG0ExK9o1U= -golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/logger.go b/logger.go index ed39672..d815772 100644 --- a/logger.go +++ b/logger.go @@ -5,10 +5,10 @@ import "C" import ( "context" + "log/slog" "code.icb4dc0.de/buildr/wasi-module-sdk-go/mem" rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1" - "golang.org/x/exp/slog" ) var _ slog.Handler = (*WASIHandler)(nil) diff --git a/protocol/unmarshal.go b/protocol/unmarshal.go index bca0b7c..662acd7 100644 --- a/protocol/unmarshal.go +++ b/protocol/unmarshal.go @@ -9,9 +9,7 @@ import ( rpcv1 "code.icb4dc0.de/buildr/wasi-module-sdk-go/protocol/generated/rpc/v1" ) -var ( - ErrUnmatchingType = errors.New("field type does not match wire value") -) +var ErrUnmatchingType = errors.New("field type does not match wire value") func Unmarshal(input *rpcv1.ModuleSpec, into any) error { cfg := unmarshalConfig{ diff --git a/registry.go b/registry.go index 01a06f9..533793a 100644 --- a/registry.go +++ b/registry.go @@ -34,7 +34,6 @@ func (r *TypeRegistry) List() (refs []Reference) { refs = make([]Reference, 0, len(r.registrations)) for k := range r.registrations { - refs = append(refs, k) } diff --git a/state_proxy.go b/state_proxy.go index 2cec67d..79e922e 100644 --- a/state_proxy.go +++ b/state_proxy.go @@ -8,8 +8,7 @@ import ( "code.icb4dc0.de/buildr/wasi-module-sdk-go/mem" ) -type StateProxy struct { -} +type StateProxy struct{} func (s StateProxy) Set(key, state []byte) error { setCmd := &rpcv1.SetState{