Skip to content

Commit f897f3c

Browse files
skittdominikh
authored andcommitted
go/ir: recognize functions in k8s.io/klog that exit the process
This logger has the same exit functions as glog. Signed-off-by: Stephen Kitt <[email protected]> Closes: gh-1110 [via git-merge-pr] (cherry picked from commit f9b753e)
1 parent 706c608 commit f897f3c

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

go/ir/exits.go

+13
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,19 @@ func (b *builder) buildExits(fn *Function) {
7171
// all of these call os.Exit after logging
7272
fn.NoReturn = AlwaysExits
7373
}
74+
case "k8s.io/klog":
75+
switch obj.(*types.Func).FullName() {
76+
case "k8s.io/klog.Exit",
77+
"k8s.io/klog.ExitDepth",
78+
"k8s.io/klog.Exitf",
79+
"k8s.io/klog.Exitln",
80+
"k8s.io/klog.Fatal",
81+
"k8s.io/klog.FatalDepth",
82+
"k8s.io/klog.Fatalf",
83+
"k8s.io/klog.Fatalln":
84+
// all of these call os.Exit after logging
85+
fn.NoReturn = AlwaysExits
86+
}
7487
}
7588
}
7689

0 commit comments

Comments
 (0)