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

@@ -52,8 +52,8 @@ func init() {
// Discard grpc logs so that they don't mess with our stdio
grpclog.SetLoggerV2(grpclog.NewLoggerV2(io.Discard, io.Discard, io.Discard))
cli.VersionPrinter = func(c *cli.Context) {
fmt.Println(c.App.Name, version.Package, c.App.Version)
cli.VersionPrinter = func(cliContext *cli.Context) {
fmt.Println(cliContext.App.Name, version.Package, cliContext.App.Version)
}
cli.VersionFlag = &cli.BoolFlag{
Name: "version",
@@ -135,8 +135,8 @@ containerd CLI
info.Command,
deprecations.Command,
}, extraCmds...)
app.Before = func(context *cli.Context) error {
if context.Bool("debug") {
app.Before = func(cliContext *cli.Context) error {
if cliContext.Bool("debug") {
return log.SetLevel("debug")
}
return nil