Skip to content

Commit 23765a6

Browse files
authored
Merge pull request #997 from cvvz/fix-panic
fix: flag panic if a flag is defined after being set
2 parents 3465228 + e73a687 commit 23765a6

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

pkg/blobfuse-proxy/main.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,13 @@ import (
2727
csicommon "sigs.k8s.io/blob-csi-driver/pkg/csi-common"
2828
)
2929

30-
func init() {
31-
_ = flag.Set("logtostderr", "true")
32-
}
33-
3430
var (
3531
blobfuseProxyEndpoint = flag.String("blobfuse-proxy-endpoint", "unix://tmp/blobfuse-proxy.sock", "blobfuse-proxy endpoint")
3632
)
3733

3834
func main() {
3935
klog.InitFlags(nil)
36+
_ = flag.Set("logtostderr", "true")
4037
flag.Parse()
4138
proto, addr, err := csicommon.ParseEndpoint(*blobfuseProxyEndpoint)
4239
if err != nil {

pkg/blobplugin/main.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ import (
3131
"k8s.io/klog/v2"
3232
)
3333

34-
func init() {
35-
_ = flag.Set("logtostderr", "true")
36-
}
37-
3834
var (
3935
endpoint = flag.String("endpoint", "unix://tmp/csi.sock", "CSI endpoint")
4036
blobfuseProxyEndpoint = flag.String("blobfuse-proxy-endpoint", "unix://tmp/blobfuse-proxy.sock", "blobfuse-proxy endpoint")
@@ -62,6 +58,7 @@ var (
6258

6359
func main() {
6460
klog.InitFlags(nil)
61+
_ = flag.Set("logtostderr", "true")
6562
flag.Parse()
6663
if *version {
6764
info, err := blob.GetVersionYAML(*driverName)

0 commit comments

Comments
 (0)