spf13 / cobra

A Commander for modern Go CLI interactions
https://cobra.dev
Apache License 2.0
38.44k stars 2.86k forks source link

Closes #2193 #2194

Open AtricoSoftware opened 2 months ago

AtricoSoftware commented 2 months ago

Context is not copied from parent to child Comment on code states copy if parent has context but code implements copy if child doesn't have context Fix makes behaviour consistent between root and sub commands w.r.t. contexts

CLAassistant commented 2 months ago

CLA assistant check
All committers have signed the CLA.

AtricoSoftware commented 2 months ago

Re-pushed and removed check completely - parent context can never be nil so no point checking Context should always be copied

lukaspj commented 1 month ago

I concur.

This issue makes it very hard to use Cobra in tests so this would be a great fix.