Capture context from cobra CLI and pass forward (#2551)

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
This commit is contained in:
Sanket Sudake
2022-09-22 13:54:05 +05:30
committed by GitHub
parent d03395949b
commit e87c84ee2c
33 changed files with 93 additions and 83 deletions
+1 -4
View File
@@ -16,7 +16,6 @@ limitations under the License.
package app
import (
"context"
"log"
"github.com/spf13/cobra"
@@ -50,13 +49,11 @@ func eventCommandHandler(cmd *cobra.Command, args []string) error {
return err
}
ctx := context.Background()
t, err := tracker.NewTracker()
if err != nil {
return err
}
return t.SendEvent(ctx, event)
return t.SendEvent(cmd.Context(), event)
}
// EventCommand reports an event to analytics