From 52990550fb67a60278074a1aef5dd15871a33a89 Mon Sep 17 00:00:00 2001 From: miaogaolin <57740293+miaogaolin@users.noreply.github.com> Date: Wed, 9 Sep 2020 11:43:47 +0800 Subject: [PATCH] fix GOMOD env fetch bug (#55) --- tools/goctl/util/project/project.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/goctl/util/project/project.go b/tools/goctl/util/project/project.go index ff1fcc8dd9bf..6d8b33b47a73 100644 --- a/tools/goctl/util/project/project.go +++ b/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 {