Skip to content

Commit 740ab6e

Browse files
authored
Merge pull request #1053 from k8s-infra-cherrypick-robot/cherry-pick-997-to-release-1.19
[release-1.19] fix: flag panic if a flag is defined after being set
2 parents 1a2a723 + 5693478 commit 740ab6e

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")
@@ -61,6 +57,7 @@ var (
6157

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

0 commit comments

Comments
 (0)