Skip to content

Commit 943a30d

Browse files
authored
build: remove duplicated func FileExist (#32768)
1 parent b19452d commit 943a30d

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

build/ci.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import (
5757
"time"
5858

5959
"github.com/cespare/cp"
60+
"github.com/ethereum/go-ethereum/common"
6061
"github.com/ethereum/go-ethereum/crypto/signify"
6162
"github.com/ethereum/go-ethereum/internal/build"
6263
"github.com/ethereum/go-ethereum/internal/download"
@@ -148,7 +149,7 @@ func executablePath(name string) string {
148149
func main() {
149150
log.SetFlags(log.Lshortfile)
150151

151-
if !build.FileExist(filepath.Join("build", "ci.go")) {
152+
if !common.FileExist(filepath.Join("build", "ci.go")) {
152153
log.Fatal("this script must be run from the root of the repository")
153154
}
154155
if len(os.Args) < 2 {
@@ -895,7 +896,7 @@ func ppaUpload(workdir, ppa, sshUser string, files []string) {
895896
var idfile string
896897
if sshkey := getenvBase64("PPA_SSH_KEY"); len(sshkey) > 0 {
897898
idfile = filepath.Join(workdir, "sshkey")
898-
if !build.FileExist(idfile) {
899+
if !common.FileExist(idfile) {
899900
os.WriteFile(idfile, sshkey, 0600)
900901
}
901902
}

internal/build/file.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,6 @@ import (
2525
"strings"
2626
)
2727

28-
// FileExist checks if a file exists at path.
29-
func FileExist(path string) bool {
30-
_, err := os.Stat(path)
31-
if err != nil && os.IsNotExist(err) {
32-
return false
33-
}
34-
return true
35-
}
36-
3728
// HashFolder iterates all files under the given directory, computing the hash
3829
// of each.
3930
func HashFolder(folder string, exlude []string) (map[string][32]byte, error) {

0 commit comments

Comments
 (0)