From c66ab4f76ceeb8e2f8082ac470bd09eb3b8abbc7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Jul 2026 21:37:51 +0000 Subject: [PATCH 1/3] Initial plan From 1f885050e331e0eb286a241b6d6b7db1eaaa1ee9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 24 Jul 2026 21:52:44 +0000 Subject: [PATCH 2/3] test: add goleak verification to cli and console package tests Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- go.mod | 1 + go.sum | 2 ++ pkg/cli/test_main_test.go | 21 ++++++++++----------- pkg/console/test_main_test.go | 13 +++++++++++++ 4 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 pkg/console/test_main_test.go diff --git a/go.mod b/go.mod index cd90ce285b4..f0ea630fdc1 100644 --- a/go.mod +++ b/go.mod @@ -102,6 +102,7 @@ require ( go.opentelemetry.io/otel v1.44.0 // indirect go.opentelemetry.io/otel/metric v1.44.0 // indirect go.opentelemetry.io/otel/trace v1.44.0 // indirect + go.uber.org/goleak v1.3.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect go.yaml.in/yaml/v4 v4.0.0-rc.6 // indirect diff --git a/go.sum b/go.sum index d8e098534f4..a923f20638f 100644 --- a/go.sum +++ b/go.sum @@ -227,6 +227,8 @@ go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRk go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA= go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk= go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE= +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.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= diff --git a/pkg/cli/test_main_test.go b/pkg/cli/test_main_test.go index c93b0fbb85c..2ce3c652e0a 100644 --- a/pkg/cli/test_main_test.go +++ b/pkg/cli/test_main_test.go @@ -6,6 +6,8 @@ import ( "os" "path/filepath" "testing" + + "go.uber.org/goleak" ) // TestMain provides setup and teardown for unit tests in the cli package @@ -17,15 +19,12 @@ func TestMain(m *testing.M) { panic("Failed to get current working directory: " + err.Error()) } - // Run all tests - code := m.Run() - - // Clean up any action cache files created during tests - // Tests may create .github/aw/actions-lock.json in the pkg/cli directory - actionCacheDir := filepath.Join(wd, ".github") - if _, err := os.Stat(actionCacheDir); err == nil { - _ = os.RemoveAll(actionCacheDir) - } - - os.Exit(code) + goleak.VerifyTestMain(m, goleak.Cleanup(func(_ int) { + // Clean up any action cache files created during tests + // Tests may create .github/aw/actions-lock.json in the pkg/cli directory + actionCacheDir := filepath.Join(wd, ".github") + if _, err := os.Stat(actionCacheDir); err == nil { + _ = os.RemoveAll(actionCacheDir) + } + })) } diff --git a/pkg/console/test_main_test.go b/pkg/console/test_main_test.go new file mode 100644 index 00000000000..c9ec8280a9f --- /dev/null +++ b/pkg/console/test_main_test.go @@ -0,0 +1,13 @@ +//go:build !integration + +package console + +import ( + "testing" + + "go.uber.org/goleak" +) + +func TestMain(m *testing.M) { + goleak.VerifyTestMain(m) +} From b6d901550979906502c35ebc5af80d2755791b0f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Jul 2026 03:04:56 +0000 Subject: [PATCH 3/3] fix: run go mod tidy to promote goleak to direct dependency Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f0ea630fdc1..fce36bdcdeb 100644 --- a/go.mod +++ b/go.mod @@ -23,6 +23,7 @@ require ( github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 github.com/stretchr/testify v1.11.1 + go.uber.org/goleak v1.3.0 golang.org/x/crypto v0.54.0 golang.org/x/mod v0.38.0 golang.org/x/sync v0.22.0 @@ -102,7 +103,6 @@ require ( go.opentelemetry.io/otel v1.44.0 // indirect go.opentelemetry.io/otel/metric v1.44.0 // indirect go.opentelemetry.io/otel/trace v1.44.0 // indirect - go.uber.org/goleak v1.3.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect go.yaml.in/yaml/v4 v4.0.0-rc.6 // indirect