From cb4ecd9fe905910cbdf110dafaad3f2a00ddc85e Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Fri, 8 Sep 2023 17:03:24 -0700 Subject: [PATCH] unix: use filepath in tests where appropriate Change-Id: I0b80cdf4fcf48b80139bf4439f4c78954c972382 Reviewed-on: https://go-review.googlesource.com/c/sys/+/527155 TryBot-Result: Gopher Robot Auto-Submit: Ian Lance Taylor Reviewed-by: Tobias Klauser LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor Reviewed-by: Heschi Kreinick Run-TryBot: Ian Lance Taylor --- unix/syscall_darwin_test.go | 6 +++--- unix/syscall_freebsd_test.go | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/unix/syscall_darwin_test.go b/unix/syscall_darwin_test.go index e8ad6bf2..4eb055cb 100644 --- a/unix/syscall_darwin_test.go +++ b/unix/syscall_darwin_test.go @@ -9,7 +9,7 @@ import ( "io/ioutil" "net" "os" - "path" + "path/filepath" "testing" "golang.org/x/sys/unix" @@ -126,8 +126,8 @@ func TestClonefileatWithRelativePaths(t *testing.T) { t.Fatal(err) } - src := path.Base(srcFile.Name()) - dst := path.Base(dstFile.Name()) + src := filepath.Base(srcFile.Name()) + dst := filepath.Base(dstFile.Name()) err = unix.Clonefileat(srcFd, src, dstFd, dst, 0) if err == unix.ENOSYS || err == unix.ENOTSUP { t.Skip("clonefileat is not available or supported, skipping test") diff --git a/unix/syscall_freebsd_test.go b/unix/syscall_freebsd_test.go index 6f26694f..e27689ac 100644 --- a/unix/syscall_freebsd_test.go +++ b/unix/syscall_freebsd_test.go @@ -13,7 +13,6 @@ import ( "net" "os" "os/exec" - "path" "path/filepath" "runtime" "testing" @@ -102,7 +101,7 @@ const testfile = "gocapmodetest" const testfile2 = testfile + "2" func CapEnterTest() { - _, err := os.OpenFile(path.Join(procArg, testfile), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666) + _, err := os.OpenFile(filepath.Join(procArg, testfile), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666) if err != nil { panic(fmt.Sprintf("OpenFile: %s", err)) } @@ -112,7 +111,7 @@ func CapEnterTest() { panic(fmt.Sprintf("CapEnter: %s", err)) } - _, err = os.OpenFile(path.Join(procArg, testfile2), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666) + _, err = os.OpenFile(filepath.Join(procArg, testfile2), os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666) if err == nil { panic("OpenFile works!") }