From d41c41a13711955b9f108bdccf96ffaec7dd153a Mon Sep 17 00:00:00 2001 From: LiuQiQuan Date: Tue, 5 Jul 2016 13:55:51 +0800 Subject: [PATCH] =?UTF-8?q?curpath=E9=9C=80=E8=A6=81=E5=81=9A=E4=B8=80?= =?UTF-8?q?=E6=AC=A1EvalSymlinks=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如果传入参数curpath是一个link的目录,gopath一般与curpath有部分是相同的根目录,但函数内部只对gopath进行EvalSymlinks,这样就导致两个目录完全不相同,最终会导致haspath为false,出错退出函数。 --- apiapp.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apiapp.go b/apiapp.go index 8ae376e..d3a6ee3 100644 --- a/apiapp.go +++ b/apiapp.go @@ -643,7 +643,8 @@ func checkEnv(appname string) (apppath, packpath string, err error) { if err != nil { return } - + curpath, _ = path.EvalSymlinks(curpath) + gopath := os.Getenv("GOPATH") Debugf("gopath:%s", gopath) if gopath == "" {