mirror of
https://github.com/beego/bee.git
synced 2024-11-01 00:00:53 +00:00
Delete the environment variable judgment
This commit is contained in:
parent
ba359957b9
commit
d9eb9b56fd
@ -81,15 +81,6 @@ func GenerateCode(cmd *commands.Command, args []string) int {
|
|||||||
beeLogger.Log.Fatal("Command is missing")
|
beeLogger.Log.Fatal("Command is missing")
|
||||||
}
|
}
|
||||||
|
|
||||||
//gps := utils.GetGOPATHs()
|
|
||||||
//if len(gps) == 0 {
|
|
||||||
// beeLogger.Log.Fatal("GOPATH environment variable is not set or empty")
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//gopath := gps[0]
|
|
||||||
//
|
|
||||||
//beeLogger.Log.Debugf("GOPATH: %s", utils.FILE(), utils.LINE(), gopath)
|
|
||||||
|
|
||||||
gcmd := args[0]
|
gcmd := args[0]
|
||||||
switch gcmd {
|
switch gcmd {
|
||||||
case "scaffold":
|
case "scaffold":
|
||||||
|
@ -948,17 +948,20 @@ func getFileName(tbName string) (filename string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getPackagePath(curpath string) (packpath string) {
|
func getPackagePath(curpath string) (packpath string) {
|
||||||
if os.Getenv(`GO111MODULE`) == `on` {
|
gopath := os.Getenv("GOPATH")
|
||||||
beeLogger.Log.Infof("GO111MODULE = on,curpath: %s", curpath)
|
if gopath == "" {
|
||||||
|
info := "GOPATH environment variable is not set or empty"
|
||||||
gomodpath := filepath.Join(curpath, `go.mod`)
|
gomodpath := filepath.Join(curpath, `go.mod`)
|
||||||
re, err := regexp.Compile(`^module\s+(.+)$`)
|
re, err := regexp.Compile(`^module\s+(.+)$`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
beeLogger.Log.Fatalf("generate regexp error:%s", err)
|
beeLogger.Log.Error(info)
|
||||||
|
beeLogger.Log.Fatalf("try `go.mod` generate regexp error:%s", err)
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
fd, err := os.Open(gomodpath)
|
fd, err := os.Open(gomodpath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
beeLogger.Log.Fatalf("Error while reading 'go.mod',%s", gomodpath)
|
beeLogger.Log.Error(info)
|
||||||
|
beeLogger.Log.Fatalf("try `go.mod` Error while reading 'go.mod',%s", gomodpath)
|
||||||
}
|
}
|
||||||
reader := bufio.NewReader(fd)
|
reader := bufio.NewReader(fd)
|
||||||
for {
|
for {
|
||||||
@ -975,16 +978,11 @@ func getPackagePath(curpath string) (packpath string) {
|
|||||||
return s[1]
|
return s[1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
beeLogger.Log.Fatalf("Error while parse 'go.mod',%s", gomodpath)
|
beeLogger.Log.Error(info)
|
||||||
return ""
|
beeLogger.Log.Fatalf("try `go.mod` Error while parse 'go.mod',%s", gomodpath)
|
||||||
}
|
} else {
|
||||||
|
|
||||||
gopath := os.Getenv("GOPATH")
|
|
||||||
if gopath == "" {
|
|
||||||
beeLogger.Log.Fatal("GOPATH environment variable is not set or empty")
|
|
||||||
}
|
|
||||||
|
|
||||||
beeLogger.Log.Debugf("GOPATH: %s", utils.FILE(), utils.LINE(), gopath)
|
beeLogger.Log.Debugf("GOPATH: %s", utils.FILE(), utils.LINE(), gopath)
|
||||||
|
}
|
||||||
|
|
||||||
appsrcpath := ""
|
appsrcpath := ""
|
||||||
haspath := false
|
haspath := false
|
||||||
|
Loading…
Reference in New Issue
Block a user