mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
internal/build: replace file.Join with filepath.Join
Signed-off-by: xiaochangbai <704566072@qq.com>
This commit is contained in:
parent
c83c0671a2
commit
c11631ce85
4 changed files with 11 additions and 11 deletions
|
|
@ -23,7 +23,6 @@ import (
|
||||||
"math/big"
|
"math/big"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
@ -398,11 +397,11 @@ func TestRenameWindows(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
f2, err := os.Create(path.Join(dir1, fname2))
|
f2, err := os.Create(filepath.Join(dir1, fname2))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
f3, err := os.Create(path.Join(dir2, fname2))
|
f3, err := os.Create(filepath.Join(dir2, fname2))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
@ -424,15 +423,15 @@ func TestRenameWindows(t *testing.T) {
|
||||||
if err := f3.Close(); err != nil {
|
if err := f3.Close(); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := os.Rename(f.Name(), path.Join(dir2, fname)); err != nil {
|
if err := os.Rename(f.Name(), filepath.Join(dir2, fname)); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if err := os.Rename(f2.Name(), path.Join(dir2, fname2)); err != nil {
|
if err := os.Rename(f2.Name(), filepath.Join(dir2, fname2)); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check file contents
|
// Check file contents
|
||||||
f, err = os.Open(path.Join(dir2, fname))
|
f, err = os.Open(filepath.Join(dir2, fname))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
@ -446,7 +445,7 @@ func TestRenameWindows(t *testing.T) {
|
||||||
t.Errorf("unexpected file contents. Got %v\n", buf)
|
t.Errorf("unexpected file contents. Got %v\n", buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err = os.Open(path.Join(dir2, fname2))
|
f, err = os.Open(filepath.Join(dir2, fname2))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ func UploadSFTP(identityFile, host, dir string, files []string) error {
|
||||||
}
|
}
|
||||||
in := io.MultiWriter(stdin, os.Stdout)
|
in := io.MultiWriter(stdin, os.Stdout)
|
||||||
for _, f := range files {
|
for _, f := range files {
|
||||||
fmt.Fprintln(in, "put", f, path.Join(dir, filepath.Base(f)))
|
fmt.Fprintln(in, "put", f, filepath.Join(dir, filepath.Base(f)))
|
||||||
}
|
}
|
||||||
fmt.Fprintln(in, "exit")
|
fmt.Fprintln(in, "exit")
|
||||||
// Some issue with the PPA sftp server makes it so the server does not
|
// Some issue with the PPA sftp server makes it so the server does not
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -98,7 +98,7 @@ func TestAuthEndpoints(t *testing.T) {
|
||||||
t.Fatalf("failed to create jwt secret: %v", err)
|
t.Fatalf("failed to create jwt secret: %v", err)
|
||||||
}
|
}
|
||||||
// Geth must read it from a file, and does not support in-memory JWT secrets, so we create a temporary file.
|
// Geth must read it from a file, and does not support in-memory JWT secrets, so we create a temporary file.
|
||||||
jwtPath := path.Join(t.TempDir(), "jwt_secret")
|
jwtPath := filepath.Join(t.TempDir(), "jwt_secret")
|
||||||
if err := os.WriteFile(jwtPath, []byte(hexutil.Encode(secret[:])), 0600); err != nil {
|
if err := os.WriteFile(jwtPath, []byte(hexutil.Encode(secret[:])), 0600); err != nil {
|
||||||
t.Fatalf("failed to prepare jwt secret file: %v", err)
|
t.Fatalf("failed to prepare jwt secret file: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ import (
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
|
@ -411,7 +412,7 @@ func TestJsonFiles(t *testing.T) {
|
||||||
// crashes or hangs.
|
// crashes or hangs.
|
||||||
func TestFuzzerFiles(t *testing.T) {
|
func TestFuzzerFiles(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
corpusdir := path.Join("testdata", "fuzzing")
|
corpusdir := filepath.Join("testdata", "fuzzing")
|
||||||
testfiles, err := os.ReadDir(corpusdir)
|
testfiles, err := os.ReadDir(corpusdir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed reading files: %v", err)
|
t.Fatalf("failed reading files: %v", err)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue