From 22a310c57087e65d73b2ba1a970274f3a72ab33d Mon Sep 17 00:00:00 2001 From: Brian Ginsburg <7957636+bgins@users.noreply.github.com> Date: Mon, 21 Oct 2024 14:13:05 -0700 Subject: [PATCH] chore: Remove CommandContext.CommandContext (#410) * chore: Remove CommandContext.CommandContext * chore: Remove redundant cleanup call This context is unused and the same context as CommandContext.Ctx --- pkg/system/context.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pkg/system/context.go b/pkg/system/context.go index b0e8f641..9023bbec 100644 --- a/pkg/system/context.go +++ b/pkg/system/context.go @@ -12,10 +12,9 @@ import ( ) type CommandContext struct { - CommandContext context.Context - Ctx context.Context - Cm *CleanupManager - CancelFunc context.CancelFunc + Ctx context.Context + Cm *CleanupManager + CancelFunc context.CancelFunc } func NewSystemContext(ctx context.Context) *CommandContext { @@ -24,10 +23,9 @@ func NewSystemContext(ctx context.Context) *CommandContext { cm := NewCleanupManager() ctx, cancel := signal.NotifyContext(ctx, os.Interrupt) return &CommandContext{ - CommandContext: ctx, - Ctx: ctx, - Cm: cm, - CancelFunc: cancel, + Ctx: ctx, + Cm: cm, + CancelFunc: cancel, } } @@ -62,7 +60,6 @@ func NewCommandContext(cmd *cobra.Command) *CommandContext { } func (cmdContext *CommandContext) Cleanup() { - cmdContext.Cm.Cleanup(cmdContext.CommandContext) cmdContext.Cm.Cleanup(cmdContext.Ctx) cmdContext.CancelFunc() }