From 2d26bcb15778b224b728bd434509a875d14ab795 Mon Sep 17 00:00:00 2001 From: zav8 Date: Sat, 13 Jul 2019 09:51:11 +0800 Subject: [PATCH] fix: check existence of file go.mod. --- utils/utils.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/utils.go b/utils/utils.go index 2aa0ff4..4c1f63b 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -29,6 +29,7 @@ import ( "time" "unicode" + "github.com/astaxie/beego/utils" beeLogger "github.com/beego/bee/logger" "github.com/beego/bee/logger/colors" ) @@ -457,8 +458,11 @@ func IsModuleEnabled(gopaths []string, cwd string) bool { return false } } - return true + if utils.FileExists(filepath.Join(cwd, "go.mod")) { + return true + } } + return false } // InDir checks whether path is in the file tree rooted at dir.