Skip to content

Commit

Permalink
global ctx
Browse files Browse the repository at this point in the history
Signed-off-by: Kartikay <kartikay_2101ce32@iitp.ac.in>
  • Loading branch information
kartikaysaxena committed Feb 27, 2025
1 parent 67d5092 commit f05ec5a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ completions/
*.wasm
.vscode/settings.json
.env.local
coverage.txt
coverage*.txt
2 changes: 1 addition & 1 deletion magefiles/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
11 changes: 6 additions & 5 deletions magefiles/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions magefiles/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit f05ec5a

Please sign in to comment.