From 4165961d3158b8af894a905be3afcadafc5437f1 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Mon, 13 Mar 2023 14:31:58 +0200 Subject: [PATCH] Rename config struct options to avoid conflict This change renames the struct for storing CLI flag values options over config to avoid a conflict with the config package. Signed-off-by: Evan Lezar --- cmd/nvidia-ctk/main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/nvidia-ctk/main.go b/cmd/nvidia-ctk/main.go index df3617e2..acfbd03f 100644 --- a/cmd/nvidia-ctk/main.go +++ b/cmd/nvidia-ctk/main.go @@ -32,16 +32,16 @@ import ( var logger = log.New() -// config defines the options that can be set for the CLI through config files, +// options defines the options that can be set for the CLI through config files, // environment variables, or command line flags -type config struct { +type options struct { // Debug indicates whether the CLI is started in "debug" mode Debug bool } func main() { - // Create a config struct to hold the parsed environment variables or command line flags - config := config{} + // Create a options struct to hold the parsed environment variables or command line flags + opts := options{} // Create the top-level CLI c := cli.NewApp() @@ -57,7 +57,7 @@ func main() { Name: "debug", Aliases: []string{"d"}, Usage: "Enable debug-level logging", - Destination: &config.Debug, + Destination: &opts.Debug, EnvVars: []string{"NVIDIA_CTK_DEBUG"}, }, } @@ -65,7 +65,7 @@ func main() { // Set log-level for all subcommands c.Before = func(c *cli.Context) error { logLevel := log.InfoLevel - if config.Debug { + if opts.Debug { logLevel = log.DebugLevel } logger.SetLevel(logLevel)