Remove context.TODO() (#310)

Remove almost all (except the ones created by informer-gen)
context.TODOs.

Signed-off-by: leonnicolas <leonloechner@gmx.de>
This commit is contained in:
leonnicolas
2022-04-28 19:39:57 +02:00
committed by GitHub
parent 7aeaa855e7
commit 0820a9d32f
5 changed files with 58 additions and 53 deletions

View File

@@ -15,6 +15,7 @@
package main
import (
"context"
"errors"
"fmt"
"net"
@@ -275,15 +276,16 @@ func runRoot(_ *cobra.Command, _ []string) error {
}
{
ctx, cancel := context.WithCancel(context.Background())
// Start the mesh.
g.Add(func() error {
logger.Log("msg", fmt.Sprintf("Starting Kilo network mesh '%v'.", version.Version))
if err := m.Run(); err != nil {
if err := m.Run(ctx); err != nil {
return fmt.Errorf("error: Kilo exited unexpectedly: %v", err)
}
return nil
}, func(error) {
m.Stop()
cancel()
})
}