Skip to content

Commit 979d215

Browse files
committed
Correctly initialize klog flags
Signed-off-by: Tamal Saha <[email protected]>
1 parent 115ccc1 commit 979d215

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

cmd/kubectl-voyager/main.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ limitations under the License.
1717
package main
1818

1919
import (
20-
"os"
21-
2220
"voyagermesh.dev/cli/pkg/cmds"
2321

2422
"gomodules.xyz/logs"
2523
_ "k8s.io/client-go/plugin/pkg/client/auth"
24+
"k8s.io/klog/v2"
2625
)
2726

2827
func main() {
29-
logs.InitLogs()
28+
rootCmd := cmds.NewRootCmd()
29+
logs.Init(rootCmd, false)
3030
defer logs.FlushLogs()
3131

32-
if err := cmds.NewRootCmd().Execute(); err != nil {
33-
os.Exit(1)
32+
if err := rootCmd.Execute(); err != nil {
33+
klog.Fatal(err)
3434
}
3535
}

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ require (
99
gomodules.xyz/x v0.0.8
1010
k8s.io/apimachinery v0.21.2
1111
k8s.io/client-go v0.21.2
12+
k8s.io/klog/v2 v2.8.0
1213
kmodules.xyz/client-go v0.0.0-20211013093146-1fbfd52e78c9
1314
sigs.k8s.io/yaml v1.2.0
1415
voyagermesh.dev/apimachinery v0.1.3
@@ -78,7 +79,6 @@ require (
7879
gopkg.in/yaml.v2 v2.4.0 // indirect
7980
k8s.io/api v0.21.2 // indirect
8081
k8s.io/apiextensions-apiserver v0.21.2 // indirect
81-
k8s.io/klog/v2 v2.8.0 // indirect
8282
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7 // indirect
8383
k8s.io/utils v0.0.0-20210527160623-6fdb442a123b // indirect
8484
kmodules.xyz/monitoring-agent-api v0.0.0-20210928135619-38ca075a2dbd // indirect

0 commit comments

Comments
 (0)