Skip to content

Commit

Permalink
internal, signer/core: replace path.Join with filepath.Join (#29489)
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronChen0 authored Apr 9, 2024
1 parent c170cc0 commit 70bf94c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions internal/build/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"log"
"os"
"os/exec"
"path"
"path/filepath"
"strconv"
"strings"
Expand Down Expand Up @@ -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 ""
}
Expand Down
4 changes: 2 additions & 2 deletions internal/jsre/jsre_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package jsre

import (
"os"
"path"
"path/filepath"
"reflect"
"testing"
"time"
Expand All @@ -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)
}
}
Expand Down
5 changes: 2 additions & 3 deletions signer/core/signed_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"fmt"
"math/big"
"os"
"path"
"path/filepath"
"strings"
"testing"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 70bf94c

Please sign in to comment.