From fd706ee05b0beff937143ee269becee514fbcbd8 Mon Sep 17 00:00:00 2001 From: Mateusz Szostok Date: Tue, 4 Jun 2019 00:05:33 +0200 Subject: [PATCH] Fix the test-broker flags parsing (#2627) --- contrib/cmd/test-broker/test-broker.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/contrib/cmd/test-broker/test-broker.go b/contrib/cmd/test-broker/test-broker.go index f41176edce6..1ccb417d839 100644 --- a/contrib/cmd/test-broker/test-broker.go +++ b/contrib/cmd/test-broker/test-broker.go @@ -41,10 +41,10 @@ var options struct { } func init() { - flags := flag.NewFlagSet("test-broker", flag.ExitOnError) - flag.IntVar(&options.Port, "port", 8005, "use '--port' option to specify the port for broker to listen on") - flag.StringVar(&options.TLSCert, "tlsCert", "", "base-64 encoded PEM block to use as the certificate for TLS. If '--tlsCert' is used, then '--tlsKey' must also be used. If '--tlsCert' is not used, then TLS will not be used.") - flag.StringVar(&options.TLSKey, "tlsKey", "", "base-64 encoded PEM block to use as the private key matching the TLS certificate. If '--tlsKey' is used, then '--tlsCert' must also be used") + flags = flag.NewFlagSet("test-broker", flag.ExitOnError) + flags.IntVar(&options.Port, "port", 8005, "use '--port' option to specify the port for broker to listen on") + flags.StringVar(&options.TLSCert, "tlsCert", "", "base-64 encoded PEM block to use as the certificate for TLS. If '--tlsCert' is used, then '--tlsKey' must also be used. If '--tlsCert' is not used, then TLS will not be used.") + flags.StringVar(&options.TLSKey, "tlsKey", "", "base-64 encoded PEM block to use as the private key matching the TLS certificate. If '--tlsKey' is used, then '--tlsCert' must also be used") klog.InitFlags(flags) } @@ -53,7 +53,6 @@ func main() { if err != nil { klog.Fatalln(err) } - flag.Parse() if err := run(); err != nil && err != context.Canceled && err != context.DeadlineExceeded { klog.Fatalln(err) }