From 4a29a0b6422737566ac92b3703fc794b2c775308 Mon Sep 17 00:00:00 2001 From: elza <44083691+elza2@users.noreply.github.com> Date: Tue, 13 Jun 2023 00:00:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20fixed=20goctl=20api=20go=20--home=20para?= =?UTF-8?q?meter=20error=20when=20loading=20non-exist=E2=80=A6=20(#3319)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: yuanyou --- tools/goctl/util/pathx/file.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/goctl/util/pathx/file.go b/tools/goctl/util/pathx/file.go index 3121a19f..e3e85383 100644 --- a/tools/goctl/util/pathx/file.go +++ b/tools/goctl/util/pathx/file.go @@ -145,15 +145,12 @@ func GetTemplateDir(category string) (string, error) { // backward compatible, it will be removed in the feature // backward compatible start. beforeTemplateDir := filepath.Join(home, version.GetGoctlVersion(), category) - entries, err := os.ReadDir(beforeTemplateDir) - if err != nil { - return "", err - } + entries, _ := os.ReadDir(beforeTemplateDir) infos := make([]fs.FileInfo, 0, len(entries)) for _, entry := range entries { info, err := entry.Info() if err != nil { - return "", err + continue } infos = append(infos, info) }