Skip to content

Commit

Permalink
Context lint.
Browse files Browse the repository at this point in the history
Signed-off-by: Nuno Cruces <[email protected]>
  • Loading branch information
mathetake authored and ncruces committed Aug 14, 2024
1 parent 510568d commit 92bb0a0
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

gofumpt := mvdan.cc/[email protected]
gosimports := github.com/rinchsan/gosimports/cmd/[email protected]
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/[email protected]
# sync this with netlify.toml!
hugo := github.com/gohugoio/[email protected]
Expand Down
4 changes: 3 additions & 1 deletion experimental/close_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion experimental/logging/log_listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion experimental/sock/sock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion imports/assemblyscript/assemblyscript_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion imports/emscripten/emscripten_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion imports/wasi_snapshot_preview1/wasi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion internal/engine/interpreter/interpreter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
4 changes: 3 additions & 1 deletion internal/integration_test/bench/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
4 changes: 3 additions & 1 deletion internal/integration_test/engine/adhoc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion internal/wasm/gofunc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down

0 comments on commit 92bb0a0

Please sign in to comment.