Skip to content

Commit

Permalink
chore: Remove CommandContext.CommandContext (#410)
Browse files Browse the repository at this point in the history
* chore: Remove CommandContext.CommandContext

* chore: Remove redundant cleanup call

This context is unused and the same context as CommandContext.Ctx
  • Loading branch information
bgins authored Oct 21, 2024
1 parent b4e56e3 commit 22a310c
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions pkg/system/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
}
}

Expand Down Expand Up @@ -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()
}
Expand Down

0 comments on commit 22a310c

Please sign in to comment.