refactor file|path (#1409)

Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
anqiansong
2022-01-03 21:32:40 +08:00
committed by GitHub
parent 290de6aa96
commit 89ce5e492b
81 changed files with 279 additions and 245 deletions

View File

@@ -10,7 +10,7 @@ import (
"github.com/tal-tech/go-zero/core/hash"
"github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/tools/goctl/update/config"
"github.com/tal-tech/go-zero/tools/goctl/util"
"github.com/tal-tech/go-zero/tools/goctl/util/pathx"
)
const (
@@ -22,7 +22,7 @@ var configFile = flag.String("f", "etc/update-api.json", "the config file")
func forChksumHandler(file string, next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if !util.FileExists(file) {
if !pathx.FileExists(file) {
logx.Errorf("file %q not exist", file)
http.Error(w, http.StatusText(http.StatusServiceUnavailable), http.StatusServiceUnavailable)
return