cmd: don't alias context package, and use cliContext for cli.Context

Unfortunately, this is a rather large diff, but perhaps worth a one-time
"rip off the bandaid" for v2. This patch removes the use of "gocontext"
as alias for stdLib's "context", and uses "cliContext" for uses of
cli.context.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-06-20 02:15:13 +02:00
parent 741c4bde51
commit dd0542f7c1
65 changed files with 754 additions and 755 deletions

View File

@@ -82,8 +82,8 @@ var killCommand = &cli.Command{
Usage: "Send signal to all processes inside the container",
},
},
Action: func(context *cli.Context) error {
id := context.Args().First()
Action: func(cliContext *cli.Context) error {
id := cliContext.Args().First()
if id == "" {
return errors.New("container id must be provided")
}
@@ -92,14 +92,14 @@ var killCommand = &cli.Command{
return err
}
var (
all = context.Bool("all")
execID = context.String("exec-id")
all = cliContext.Bool("all")
execID = cliContext.String("exec-id")
opts []containerd.KillOpts
)
if all && execID != "" {
return errors.New("specify an exec-id or all; not both")
}
client, ctx, cancel, err := commands.NewClient(context)
client, ctx, cancel, err := commands.NewClient(cliContext)
if err != nil {
return err
}
@@ -114,8 +114,8 @@ var killCommand = &cli.Command{
if err != nil {
return err
}
if context.String("signal") != "" {
sig, err = signal.ParseSignal(context.String("signal"))
if cliContext.String("signal") != "" {
sig, err = signal.ParseSignal(cliContext.String("signal"))
if err != nil {
return err
}