Skip to content

Commit

Permalink
cmd: remove nil context check on test command (#3086)
Browse files Browse the repository at this point in the history
Context nil check is not necessary, as [cobra is always checking on their end](https://github.com/spf13/cobra/blob/v1.8.0/command.go#L1053) if the context is nil and if so, assigning background context to it.

category: refactor
ticket: none
  • Loading branch information
KaloyanTanev authored May 22, 2024
1 parent ddb95fd commit 280877e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 9 deletions.
3 changes: 0 additions & 3 deletions cmd/testbeacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ func runTestBeacon(ctx context.Context, w io.Writer, cfg testBeaconConfig) (err
}
sortTests(queuedTests)

if ctx == nil {
ctx = context.Background()
}
timeoutCtx, cancel := context.WithTimeout(ctx, cfg.Timeout)
defer cancel()

Expand Down
3 changes: 0 additions & 3 deletions cmd/testpeers.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,6 @@ func runTestPeers(ctx context.Context, w io.Writer, conf testPeersConfig) error
return errors.New("test case not supported")
}

if ctx == nil {
ctx = context.Background()
}
timeoutCtx, cancel := context.WithTimeout(ctx, conf.Timeout)
defer cancel()

Expand Down
3 changes: 0 additions & 3 deletions cmd/testvalidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ func runTestValidator(ctx context.Context, w io.Writer, cfg testValidatorConfig)
}
sortTests(queuedTests)

if ctx == nil {
ctx = context.Background()
}
timeoutCtx, cancel := context.WithTimeout(ctx, cfg.Timeout)
defer cancel()

Expand Down

0 comments on commit 280877e

Please sign in to comment.