diff --git a/.gitignore b/.gitignore index 48e26d5fcb..0b3930b32e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,4 @@ completions/ *.wasm .vscode/settings.json .env.local -coverage.txt \ No newline at end of file +coverage*.txt \ No newline at end of file diff --git a/magefiles/go.mod b/magefiles/go.mod index fb46ea4cfe..1ae61a36b5 100644 --- a/magefiles/go.mod +++ b/magefiles/go.mod @@ -6,6 +6,7 @@ toolchain go1.24.0 require ( github.com/agnivade/wasmbrowsertest v0.8.0 + github.com/authzed/ctxkey v0.0.0-20250127172433-d71cd97e3833 github.com/bufbuild/buf v1.35.1 github.com/ecordell/optgen v0.0.9 github.com/envoyproxy/protoc-gen-validate v1.0.4 @@ -27,7 +28,6 @@ require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/antlr4-go/antlr/v4 v4.13.0 // indirect - github.com/authzed/ctxkey v0.0.0-20250127172433-d71cd97e3833 // indirect github.com/bufbuild/protocompile v0.14.0 // indirect github.com/bufbuild/protoplugin v0.0.0-20240323223605-e2735f6c31ee // indirect github.com/bufbuild/protovalidate-go v0.6.2 // indirect diff --git a/magefiles/test.go b/magefiles/test.go index 70a1193661..c2d7c5774f 100644 --- a/magefiles/test.go +++ b/magefiles/test.go @@ -9,22 +9,23 @@ import ( "strings" "github.com/authzed/ctxkey" - "github.com/magefile/mage/mg" "github.com/magefile/mage/sh" ) type Test mg.Namespace -var emptyEnv map[string]string +var ( + emptyEnv map[string]string + ctxMyKey = ctxkey.New[bool]() +) // All Runs all test suites -func (t Test) All() error { +func (t Test) All(ctx context.Context) error { ds := Testds{} c := Testcons{} cover := parseCommandLineFlags() - ctxMyKey := ctxkey.New[bool]() - ctx := ctxMyKey.WithValue(context.Background(), cover) + ctx = ctxMyKey.WithValue(context.Background(), cover) mg.CtxDeps(ctx, t.Unit, t.Integration, t.Steelthread, t.Image, t.Analyzers, ds.Crdb, ds.Postgres, ds.Spanner, ds.Mysql, c.Crdb, c.Spanner, c.Postgres, c.Mysql) diff --git a/magefiles/util.go b/magefiles/util.go index 385aefff3d..738fe333c7 100644 --- a/magefiles/util.go +++ b/magefiles/util.go @@ -12,7 +12,6 @@ import ( "path/filepath" "strings" - "github.com/authzed/ctxkey" "github.com/google/uuid" "github.com/magefile/mage/mg" "github.com/magefile/mage/sh" @@ -46,7 +45,6 @@ func testWithArgs(ctx context.Context, args ...string) ([]string, error) { "-failfast", "-count=1", }, args...) - ctxMyKey := ctxkey.New[bool]() if cover := ctxMyKey.MustValue(ctx); cover { if err := os.MkdirAll("coverage", 0o700); err != nil { return nil, fmt.Errorf("failed to create coverage directory: %w", err)