From ebcdcf53f57fb453dad5a6ca2da8398e18f016c8 Mon Sep 17 00:00:00 2001 From: Curtis Robert Date: Tue, 30 Jan 2024 15:50:59 -0800 Subject: [PATCH] [chore][exporter/fileexporter] Enable goleak check --- exporter/fileexporter/go.mod | 1 + exporter/fileexporter/go.sum | 1 + exporter/fileexporter/package_test.go | 16 ++++++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 exporter/fileexporter/package_test.go diff --git a/exporter/fileexporter/go.mod b/exporter/fileexporter/go.mod index 9bcef2e3cf25..f709beb0c344 100644 --- a/exporter/fileexporter/go.mod +++ b/exporter/fileexporter/go.mod @@ -14,6 +14,7 @@ require ( go.opentelemetry.io/collector/pdata v1.0.2-0.20240130181942-9c7177496fd5 go.opentelemetry.io/otel/metric v1.22.0 go.opentelemetry.io/otel/trace v1.22.0 + go.uber.org/goleak v1.3.0 gopkg.in/natefinch/lumberjack.v2 v2.2.1 ) diff --git a/exporter/fileexporter/go.sum b/exporter/fileexporter/go.sum index 24be81c34a43..1a39b1df1adf 100644 --- a/exporter/fileexporter/go.sum +++ b/exporter/fileexporter/go.sum @@ -95,6 +95,7 @@ go.opentelemetry.io/otel/sdk/metric v1.22.0/go.mod h1:KjQGeMIDlBNEOo6HvjhxIec1p/ go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= diff --git a/exporter/fileexporter/package_test.go b/exporter/fileexporter/package_test.go new file mode 100644 index 000000000000..dbd651260316 --- /dev/null +++ b/exporter/fileexporter/package_test.go @@ -0,0 +1,16 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +package fileexporter + +import ( + "testing" + + "go.uber.org/goleak" +) + +// The IgnoreTopFunction call prevents catching the leak generated by the natefinch/lumberjack package. +// Existing issue for leak: https://github.com/natefinch/lumberjack/issues/56 +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m, goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun")) +}