Skip to content

Find, verify, and analyze leaked credentials

[chore] Remove parent setting / getting in Context wrapper (#1516)

Miccah8ec5e4916c91
diff --git a/pkg/context/context.go b/pkg/context/context.go
index ef0df1086..330290808 100644
--- a/pkg/context/context.go
+++ b/pkg/context/context.go
@@ -18,22 +18,11 @@ var (
type Context interface {
context.Context
Logger() logr.Logger
- Parent() context.Context
- SetParent(ctx context.Context) Context
}
-// Parent returns the parent context.
-func (l logCtx) Parent() context.Context {
- return l.Context
-}
-
-// SetParent sets the parent context on the context.
-func (l logCtx) SetParent(ctx context.Context) Context {
- l.Context = ctx
- return l
-}
-
-type CancelFunc context.CancelFunc
+// CancelFunc is a type alias to context.CancelFunc to allow use as if they are
+// the same types.
+type CancelFunc = context.CancelFunc
// logCtx implements Context.
type logCtx struct {
diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go
index 9c95ba745..d5737b14a 100644
--- a/pkg/engine/engine.go
+++ b/pkg/engine/engine.go
@@ -130,7 +130,7 @@ func Start(ctx context.Context, options ...EngineOption) *Engine {
sourcesWg, egCtx := errgroup.WithContext(ctx)
sourcesWg.SetLimit(e.concurrency)
e.sourcesWg = sourcesWg
- ctx.SetParent(egCtx)
+ ctx = context.WithLogger(egCtx, ctx.Logger())
if len(e.decoders) == 0 {
e.decoders = decoders.DefaultDecoders()