diff --git a/.github/workflows/commit.yaml b/.github/workflows/commit.yaml index 50fcde7a54..01cd1a3f12 100644 --- a/.github/workflows/commit.yaml +++ b/.github/workflows/commit.yaml @@ -14,7 +14,7 @@ on: - 'netlify.toml' env: # Update this prior to requiring a higher minor version in go.mod - GO_VERSION: "1.22" + GO_VERSION: "1.23" defaults: run: # use bash for all operating systems unless overridden diff --git a/Makefile b/Makefile index f1ab01b353..17e264e01c 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ gofumpt := mvdan.cc/gofumpt@v0.6.0 gosimports := github.com/rinchsan/gosimports/cmd/gosimports@v0.3.8 -golangci_lint := github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1 +golangci_lint := github.com/golangci/golangci-lint/cmd/golangci-lint@v1.60.0 asmfmt := github.com/klauspost/asmfmt/cmd/asmfmt@v1.3.2 # sync this with netlify.toml! hugo := github.com/gohugoio/hugo@v0.115.2 diff --git a/experimental/close_test.go b/experimental/close_test.go index 5c3ad81745..9d88ed89bd 100644 --- a/experimental/close_test.go +++ b/experimental/close_test.go @@ -9,8 +9,10 @@ import ( "github.com/tetratelabs/wazero/internal/testing/require" ) +type arbitrary struct{} + // testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors. -var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary") +var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary") func TestWithCloseNotifier(t *testing.T) { tests := []struct { diff --git a/experimental/logging/log_listener_test.go b/experimental/logging/log_listener_test.go index 284cbb94f8..2cc953edbe 100644 --- a/experimental/logging/log_listener_test.go +++ b/experimental/logging/log_listener_test.go @@ -15,8 +15,10 @@ import ( "github.com/tetratelabs/wazero/internal/wasm" ) +type arbitrary struct{} + // testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors. -var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary") +var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary") func Test_loggingListener(t *testing.T) { wasiFuncName := wasi.RandomGetName diff --git a/experimental/sock/sock_test.go b/experimental/sock/sock_test.go index d81be2d369..f14b8ab208 100644 --- a/experimental/sock/sock_test.go +++ b/experimental/sock/sock_test.go @@ -9,8 +9,10 @@ import ( "github.com/tetratelabs/wazero/internal/testing/require" ) +type arbitrary struct{} + // testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors. -var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary") +var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary") func TestWithSockConfig(t *testing.T) { tests := []struct { diff --git a/imports/assemblyscript/assemblyscript_test.go b/imports/assemblyscript/assemblyscript_test.go index 04bb74db1e..71b4736cda 100644 --- a/imports/assemblyscript/assemblyscript_test.go +++ b/imports/assemblyscript/assemblyscript_test.go @@ -24,8 +24,10 @@ import ( "github.com/tetratelabs/wazero/sys" ) +type arbitrary struct{} + // testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors. -var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary") +var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary") func TestAbort(t *testing.T) { tests := []struct { diff --git a/imports/emscripten/emscripten_test.go b/imports/emscripten/emscripten_test.go index 5bad84a137..3ce7eabf74 100644 --- a/imports/emscripten/emscripten_test.go +++ b/imports/emscripten/emscripten_test.go @@ -35,8 +35,10 @@ var growWasm []byte //go:embed testdata/invoke.wasm var invokeWasm []byte +type arbitrary struct{} + // testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors. -var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary") +var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary") // TestGrow is an integration test until we have an Emscripten example. func TestGrow(t *testing.T) { diff --git a/imports/wasi_snapshot_preview1/wasi_test.go b/imports/wasi_snapshot_preview1/wasi_test.go index 7b250b29b7..4808dcc916 100644 --- a/imports/wasi_snapshot_preview1/wasi_test.go +++ b/imports/wasi_snapshot_preview1/wasi_test.go @@ -18,8 +18,10 @@ import ( "github.com/tetratelabs/wazero/sys" ) +type arbitrary struct{} + // testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors. -var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary") +var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary") const testMemoryPageSize = 1 diff --git a/internal/engine/interpreter/interpreter_test.go b/internal/engine/interpreter/interpreter_test.go index 6ac98909b3..f7606a3195 100644 --- a/internal/engine/interpreter/interpreter_test.go +++ b/internal/engine/interpreter/interpreter_test.go @@ -12,8 +12,10 @@ import ( "github.com/tetratelabs/wazero/internal/wasm" ) +type arbitrary struct{} + // testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors. -var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary") +var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary") func TestInterpreter_peekValues(t *testing.T) { ce := &callEngine{} diff --git a/internal/integration_test/bench/bench_test.go b/internal/integration_test/bench/bench_test.go index 5cf468564f..5dacbfc699 100644 --- a/internal/integration_test/bench/bench_test.go +++ b/internal/integration_test/bench/bench_test.go @@ -14,8 +14,10 @@ import ( "github.com/tetratelabs/wazero/internal/platform" ) +type arbitrary struct{} + // testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors. -var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary") +var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary") // caseWasm was compiled from TinyGo testdata/case.go // diff --git a/internal/integration_test/engine/adhoc_test.go b/internal/integration_test/engine/adhoc_test.go index 2f4f5e2623..178d61bd24 100644 --- a/internal/integration_test/engine/adhoc_test.go +++ b/internal/integration_test/engine/adhoc_test.go @@ -88,8 +88,10 @@ func TestEngineInterpreter(t *testing.T) { runAllTests(t, tests, wazero.NewRuntimeConfigInterpreter().WithCloseOnContextDone(true), false) } +type arbitrary struct{} + // testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors. -var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary") +var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary") const i32, i64, f32, f64, v128 = wasm.ValueTypeI32, wasm.ValueTypeI64, wasm.ValueTypeF32, wasm.ValueTypeF64, wasm.ValueTypeV128 @@ -406,7 +408,8 @@ func testHostFuncMemory(t *testing.T, r wazero.Runtime) { // testNestedGoContext ensures context is updated when a function calls another. func testNestedGoContext(t *testing.T, r wazero.Runtime) { - nestedCtx := context.WithValue(context.Background(), struct{}{}, "nested") + type arbitrary struct{} + nestedCtx := context.WithValue(context.Background(), arbitrary{}, "arbitrary") importedName := t.Name() + "-imported" importingName := t.Name() + "-importing" diff --git a/internal/wasm/gofunc_test.go b/internal/wasm/gofunc_test.go index 8b2e8b8c26..802fd53011 100644 --- a/internal/wasm/gofunc_test.go +++ b/internal/wasm/gofunc_test.go @@ -10,8 +10,10 @@ import ( "github.com/tetratelabs/wazero/internal/testing/require" ) +type arbitrary struct{} + // testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors. -var testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary") +var testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary") func Test_parseGoFunc(t *testing.T) { tests := []struct { diff --git a/internal/wasm/module_instance_test.go b/internal/wasm/module_instance_test.go index e36e9dee1d..cc38244a8a 100644 --- a/internal/wasm/module_instance_test.go +++ b/internal/wasm/module_instance_test.go @@ -267,7 +267,8 @@ func TestModuleInstance_CloseModuleOnCanceledOrTimeout(t *testing.T) { const duration = time.Second ctx, cancel := context.WithTimeout(context.Background(), duration) defer cancel() - done := cc.CloseModuleOnCanceledOrTimeout(context.WithValue(ctx, struct{}{}, 1)) // Wrapping arbitrary context. + type arbitrary struct{} + done := cc.CloseModuleOnCanceledOrTimeout(context.WithValue(ctx, arbitrary{}, "arbitrary")) // Wrapping arbitrary context. time.Sleep(duration * 2) defer done() @@ -285,7 +286,8 @@ func TestModuleInstance_CloseModuleOnCanceledOrTimeout(t *testing.T) { t.Run("cancel", func(t *testing.T) { cc := &ModuleInstance{ModuleName: "test", s: s, Sys: internalsys.DefaultContext(nil)} ctx, cancel := context.WithCancel(context.Background()) - done := cc.CloseModuleOnCanceledOrTimeout(context.WithValue(ctx, struct{}{}, 1)) // Wrapping arbitrary context. + type arbitrary struct{} + done := cc.CloseModuleOnCanceledOrTimeout(context.WithValue(ctx, arbitrary{}, "arbitrary")) // Wrapping arbitrary context. cancel() // Make sure nothing panics or otherwise gets weird with redundant call to cancel(). cancel() @@ -312,7 +314,8 @@ func TestModuleInstance_CloseModuleOnCanceledOrTimeout(t *testing.T) { // Wrap the cancel context by timeout. ctx, cancel = context.WithTimeout(ctx, duration) defer cancel() - done := cc.CloseModuleOnCanceledOrTimeout(context.WithValue(ctx, struct{}{}, 1)) // Wrapping arbitrary context. + type arbitrary struct{} + done := cc.CloseModuleOnCanceledOrTimeout(context.WithValue(ctx, arbitrary{}, "arbitrary")) // Wrapping arbitrary context. time.Sleep(duration * 2) defer done() @@ -335,7 +338,8 @@ func TestModuleInstance_CloseModuleOnCanceledOrTimeout(t *testing.T) { ctx, timeoutDone = context.WithTimeout(ctx, time.Second*1000) defer timeoutDone() - done := cc.CloseModuleOnCanceledOrTimeout(context.WithValue(ctx, struct{}{}, 1)) // Wrapping arbitrary context. + type arbitrary struct{} + done := cc.CloseModuleOnCanceledOrTimeout(context.WithValue(ctx, arbitrary{}, "arbitrary")) // Wrapping arbitrary context. cancel() defer done() diff --git a/runtime_test.go b/runtime_test.go index b7fce3891f..60b280b644 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -19,10 +19,12 @@ import ( "github.com/tetratelabs/wazero/sys" ) +type arbitrary struct{} + var ( binaryNamedZero = binaryencoding.EncodeModule(&wasm.Module{NameSection: &wasm.NameSection{ModuleName: "0"}}) // testCtx is an arbitrary, non-default context. Non-nil also prevents linter errors. - testCtx = context.WithValue(context.Background(), struct{}{}, "arbitrary") + testCtx = context.WithValue(context.Background(), arbitrary{}, "arbitrary") ) var _ context.Context = &HostContext{}