From 70bf94c34e4a6320c865a90cbfeec38a0aef7378 Mon Sep 17 00:00:00 2001 From: Aaron Chen Date: Tue, 9 Apr 2024 14:22:53 +0800 Subject: [PATCH] internal, signer/core: replace path.Join with filepath.Join (#29489) --- internal/build/util.go | 3 +-- internal/jsre/jsre_test.go | 4 ++-- signer/core/signed_data_test.go | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/internal/build/util.go b/internal/build/util.go index e57a4e3a9a..aee8bf0fc8 100644 --- a/internal/build/util.go +++ b/internal/build/util.go @@ -27,7 +27,6 @@ import ( "log" "os" "os/exec" - "path" "path/filepath" "strconv" "strings" @@ -112,7 +111,7 @@ func RunGit(args ...string) string { // readGitFile returns content of file in .git directory. func readGitFile(file string) string { - content, err := os.ReadFile(path.Join(".git", file)) + content, err := os.ReadFile(filepath.Join(".git", file)) if err != nil { return "" } diff --git a/internal/jsre/jsre_test.go b/internal/jsre/jsre_test.go index bb4ff5fa4f..18ef39e2f4 100644 --- a/internal/jsre/jsre_test.go +++ b/internal/jsre/jsre_test.go @@ -18,7 +18,7 @@ package jsre import ( "os" - "path" + "path/filepath" "reflect" "testing" "time" @@ -42,7 +42,7 @@ func (no *testNativeObjectBinding) TestMethod(call goja.FunctionCall) goja.Value func newWithTestJS(t *testing.T, testjs string) *JSRE { dir := t.TempDir() if testjs != "" { - if err := os.WriteFile(path.Join(dir, "test.js"), []byte(testjs), os.ModePerm); err != nil { + if err := os.WriteFile(filepath.Join(dir, "test.js"), []byte(testjs), os.ModePerm); err != nil { t.Fatal("cannot create test.js:", err) } } diff --git a/signer/core/signed_data_test.go b/signer/core/signed_data_test.go index a4fe7a22dd..d0637010ba 100644 --- a/signer/core/signed_data_test.go +++ b/signer/core/signed_data_test.go @@ -23,7 +23,6 @@ import ( "fmt" "math/big" "os" - "path" "path/filepath" "strings" "testing" @@ -386,7 +385,7 @@ func TestJsonFiles(t *testing.T) { continue } expectedFailure := strings.HasPrefix(fInfo.Name(), "expfail") - data, err := os.ReadFile(path.Join("testdata", fInfo.Name())) + data, err := os.ReadFile(filepath.Join("testdata", fInfo.Name())) if err != nil { t.Errorf("Failed to read file %v: %v", fInfo.Name(), err) continue @@ -419,7 +418,7 @@ func TestFuzzerFiles(t *testing.T) { } verbose := false for i, fInfo := range testfiles { - data, err := os.ReadFile(path.Join(corpusdir, fInfo.Name())) + data, err := os.ReadFile(filepath.Join(corpusdir, fInfo.Name())) if err != nil { t.Errorf("Failed to read file %v: %v", fInfo.Name(), err) continue