all: replace path.Join with filepath.Join #29479 (#1179)

This commit is contained in:
JukLee0ira 2025-07-01 18:26:02 +08:00 committed by GitHub
parent 87ed24a113
commit 69e9f41b4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 8 deletions

View file

@ -45,7 +45,6 @@ import (
"log"
"os"
"os/exec"
"path"
"path/filepath"
"runtime"
"strings"
@ -377,7 +376,7 @@ func downloadProtocGenGo(cachedir string) string {
url := fmt.Sprintf("https://github.com/protocolbuffers/protobuf-go/releases/download/v%s/%s", version, archiveName)
archivePath := path.Join(cachedir, archiveName)
archivePath := filepath.Join(cachedir, archiveName)
if err := csdb.DownloadFile(url, archivePath); err != nil {
log.Fatal(err)
}

View file

@ -23,7 +23,6 @@ import (
"log"
"os"
"os/exec"
"path"
"path/filepath"
"runtime"
"strconv"
@ -116,7 +115,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 ""
}

View file

@ -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)
}
}

View file

@ -22,7 +22,7 @@ import (
"fmt"
"net/http"
"os"
"path"
"path/filepath"
"testing"
"time"
@ -98,7 +98,7 @@ func TestAuthEndpoints(t *testing.T) {
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.
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 {
t.Fatalf("failed to prepare jwt secret file: %v", err)
}