From 943a30d1ee12a482a1a3e920dccde3bbe705ce7a Mon Sep 17 00:00:00 2001 From: cui Date: Mon, 29 Sep 2025 10:17:47 +0800 Subject: [PATCH] build: remove duplicated func FileExist (#32768) --- build/ci.go | 5 +++-- internal/build/file.go | 9 --------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/build/ci.go b/build/ci.go index c6f4f28c87..da867a1516 100644 --- a/build/ci.go +++ b/build/ci.go @@ -57,6 +57,7 @@ import ( "time" "github.com/cespare/cp" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto/signify" "github.com/ethereum/go-ethereum/internal/build" "github.com/ethereum/go-ethereum/internal/download" @@ -148,7 +149,7 @@ func executablePath(name string) string { func main() { log.SetFlags(log.Lshortfile) - if !build.FileExist(filepath.Join("build", "ci.go")) { + if !common.FileExist(filepath.Join("build", "ci.go")) { log.Fatal("this script must be run from the root of the repository") } if len(os.Args) < 2 { @@ -895,7 +896,7 @@ func ppaUpload(workdir, ppa, sshUser string, files []string) { var idfile string if sshkey := getenvBase64("PPA_SSH_KEY"); len(sshkey) > 0 { idfile = filepath.Join(workdir, "sshkey") - if !build.FileExist(idfile) { + if !common.FileExist(idfile) { os.WriteFile(idfile, sshkey, 0600) } } diff --git a/internal/build/file.go b/internal/build/file.go index 7490af281e..2cd090c42c 100644 --- a/internal/build/file.go +++ b/internal/build/file.go @@ -25,15 +25,6 @@ import ( "strings" ) -// FileExist checks if a file exists at path. -func FileExist(path string) bool { - _, err := os.Stat(path) - if err != nil && os.IsNotExist(err) { - return false - } - return true -} - // HashFolder iterates all files under the given directory, computing the hash // of each. func HashFolder(folder string, exlude []string) (map[string][32]byte, error) {