Skip to content

Instantly share code, notes, and snippets.

@ajm188
Created November 3, 2021 10:39
Show Gist options
  • Save ajm188/3f85a5a4922d91fb7480a8892027d0f1 to your computer and use it in GitHub Desktop.
Save ajm188/3f85a5a4922d91fb7480a8892027d0f1 to your computer and use it in GitHub Desktop.
mysqlctl => pflag
diff --git a/go/flagutil/flagutil.go b/go/flagutil/flagutil.go
index a03cb972d1..0b316fbd5a 100644
--- a/go/flagutil/flagutil.go
+++ b/go/flagutil/flagutil.go
@@ -83,6 +83,11 @@ func (value StringListValue) String() string {
}
+// Type is part of the pflag.Value interface.
+func (value StringListValue) Type() string {
+ return "[]string"
+}
+
// StringListVar defines a []string flag with the specified name, value and usage
// string. The argument 'p' points to a []string in which to store the value of the flag.
func StringListVar(p *[]string, name string, defaultValue []string, usage string) {
diff --git a/go/cmd/mysqlctl/mysqlctl.go b/go/cmd/mysqlctl/mysqlctl.go
index d5868169e1..212063e2cb 100644
--- a/go/cmd/mysqlctl/mysqlctl.go
+++ b/go/cmd/mysqlctl/mysqlctl.go
@@ -18,7 +18,7 @@
package main
import (
- "flag"
+ flag "github.com/spf13/pflag"
"fmt"
"os"
"time"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment