Skip to content

Commit

Permalink
go/ir: recognize functions in k8s.io/klog that exit the process
Browse files Browse the repository at this point in the history
This logger has the same exit functions as glog.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
Closes: gh-1110 [via git-merge-pr]
(cherry picked from commit f9b753e)
  • Loading branch information
skitt authored and dominikh committed Nov 11, 2021
1 parent 706c608 commit f897f3c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions go/ir/exits.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ func (b *builder) buildExits(fn *Function) {
// all of these call os.Exit after logging
fn.NoReturn = AlwaysExits
}
case "k8s.io/klog":
switch obj.(*types.Func).FullName() {
case "k8s.io/klog.Exit",
"k8s.io/klog.ExitDepth",
"k8s.io/klog.Exitf",
"k8s.io/klog.Exitln",
"k8s.io/klog.Fatal",
"k8s.io/klog.FatalDepth",
"k8s.io/klog.Fatalf",
"k8s.io/klog.Fatalln":
// all of these call os.Exit after logging
fn.NoReturn = AlwaysExits
}
}
}

Expand Down

0 comments on commit f897f3c

Please sign in to comment.