From 607be0585fdc659ec3c043c989a8a6f86fcc14db Mon Sep 17 00:00:00 2001 From: praveensastry Date: Tue, 6 Aug 2019 01:15:48 +1000 Subject: Add option to configure reference leak checking --- pkg/refs/refcounter.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'pkg/refs') diff --git a/pkg/refs/refcounter.go b/pkg/refs/refcounter.go index 6ecbace9e..417f4a2d6 100644 --- a/pkg/refs/refcounter.go +++ b/pkg/refs/refcounter.go @@ -231,6 +231,20 @@ const ( LeaksLogTraces ) +// String returns LeakMode's string representation. +func (l LeakMode) String() string { + switch l { + case NoLeakChecking: + return "NoLeakChecking" + case LeaksLogWarning: + return "LeaksLogWarning" + case LeaksLogTraces: + return "LeaksLogTraces" + default: + panic(fmt.Sprintf("Invalid leakmode: %d", l)) + } +} + // leakMode stores the current mode for the reference leak checker. // // Values must be one of the LeakMode values. -- cgit v1.2.3