From 60e313dfedfa1f82ac72a063691a3f378b53d72d Mon Sep 17 00:00:00 2001 From: Eric Yan Date: Fri, 29 May 2026 15:28:32 +0000 Subject: [PATCH] Use os.TempDir() for test socket path Refactor newTestMigrationContext to set ServeSocketFile via os.TempDir() and remove runtime.Caller-based path derivation. --- go/logic/test_utils.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/go/logic/test_utils.go b/go/logic/test_utils.go index f552cfc76..cdcfcee84 100644 --- a/go/logic/test_utils.go +++ b/go/logic/test_utils.go @@ -4,8 +4,8 @@ import ( "context" "fmt" + "os" "path/filepath" - "runtime" "github.com/github/gh-ost/go/base" "github.com/github/gh-ost/go/mysql" @@ -68,9 +68,7 @@ func newTestMigrationContext() *base.MigrationContext { migrationContext.PanicOnWarnings = true migrationContext.AllowedRunningOnMaster = true - //nolint:dogsled - _, filename, _, _ := runtime.Caller(0) - migrationContext.ServeSocketFile = filepath.Join(filepath.Dir(filename), "../../tmp/gh-ost.sock") + migrationContext.ServeSocketFile = filepath.Join(os.TempDir(), "gh-ost.sock") return migrationContext }