瀏覽代碼

fix GOMOD env fetch bug (#55)

miaogaolin 5 年之前
父節點
當前提交
52990550fb
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      tools/goctl/util/project/project.go

+ 4 - 0
tools/goctl/util/project/project.go

@@ -2,6 +2,7 @@ package project
 
 import (
 	"io/ioutil"
+	"os"
 	"os/exec"
 	"path/filepath"
 	"regexp"
@@ -62,6 +63,9 @@ func Prepare(projectDir string, checkGrpcEnv bool) (*Project, error) {
 		return nil, err
 	}
 	goMod = strings.TrimSpace(ret)
+	if goMod == os.DevNull {
+		goMod = ""
+	}
 
 	ret, err = execx.Run(constGoPath, "")
 	if err != nil {