internal, signer/core: replace path.Join with filepath.Join (#29489)

This commit is contained in:
Aaron Chen 2024-04-09 14:22:53 +08:00 committed by GitHub
parent c170cc0ab0
commit 70bf94c34e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 7 deletions

@ -27,7 +27,6 @@ import (
"log" "log"
"os" "os"
"os/exec" "os/exec"
"path"
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings" "strings"
@ -112,7 +111,7 @@ func RunGit(args ...string) string {
// readGitFile returns content of file in .git directory. // readGitFile returns content of file in .git directory.
func readGitFile(file string) string { func readGitFile(file string) string {
content, err := os.ReadFile(path.Join(".git", file)) content, err := os.ReadFile(filepath.Join(".git", file))
if err != nil { if err != nil {
return "" return ""
} }

@ -18,7 +18,7 @@ package jsre
import ( import (
"os" "os"
"path" "path/filepath"
"reflect" "reflect"
"testing" "testing"
"time" "time"
@ -42,7 +42,7 @@ func (no *testNativeObjectBinding) TestMethod(call goja.FunctionCall) goja.Value
func newWithTestJS(t *testing.T, testjs string) *JSRE { func newWithTestJS(t *testing.T, testjs string) *JSRE {
dir := t.TempDir() dir := t.TempDir()
if testjs != "" { 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) t.Fatal("cannot create test.js:", err)
} }
} }

@ -23,7 +23,6 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"os" "os"
"path"
"path/filepath" "path/filepath"
"strings" "strings"
"testing" "testing"
@ -386,7 +385,7 @@ func TestJsonFiles(t *testing.T) {
continue continue
} }
expectedFailure := strings.HasPrefix(fInfo.Name(), "expfail") 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 { if err != nil {
t.Errorf("Failed to read file %v: %v", fInfo.Name(), err) t.Errorf("Failed to read file %v: %v", fInfo.Name(), err)
continue continue
@ -419,7 +418,7 @@ func TestFuzzerFiles(t *testing.T) {
} }
verbose := false verbose := false
for i, fInfo := range testfiles { 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 { if err != nil {
t.Errorf("Failed to read file %v: %v", fInfo.Name(), err) t.Errorf("Failed to read file %v: %v", fInfo.Name(), err)
continue continue