mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix panic in runsc flags
When printing flags, FlagSet.PrintDefaults compares the Zero value to the flag default value. The Zero refs.LeakMode value was panicking in String() because it didn't expect the default to be used Closes #4023 PiperOrigin-RevId: 333150836
This commit is contained in:
committed by
gVisor bot
parent
6e5ea605f4
commit
778c367171
@@ -257,6 +257,8 @@ func (l *LeakMode) Get() interface{} {
|
||||
// String implements flag.Value.
|
||||
func (l *LeakMode) String() string {
|
||||
switch *l {
|
||||
case UninitializedLeakChecking:
|
||||
return "uninitialized"
|
||||
case NoLeakChecking:
|
||||
return "disabled"
|
||||
case LeaksLogWarning:
|
||||
@@ -264,7 +266,7 @@ func (l *LeakMode) String() string {
|
||||
case LeaksLogTraces:
|
||||
return "log-traces"
|
||||
}
|
||||
panic(fmt.Sprintf("invalid ref leak mode %q", *l))
|
||||
panic(fmt.Sprintf("invalid ref leak mode %d", *l))
|
||||
}
|
||||
|
||||
// leakMode stores the current mode for the reference leak checker.
|
||||
|
||||
Reference in New Issue
Block a user