diff --git a/cmd/commands/version/banner.go b/cmd/commands/version/banner.go index c0859ce..69954e8 100644 --- a/cmd/commands/version/banner.go +++ b/cmd/commands/version/banner.go @@ -23,7 +23,6 @@ type RuntimeInfo struct { GOROOT string Compiler string BeeVersion string - BeegoVersion string Published string } @@ -61,7 +60,6 @@ func show(out io.Writer, content string) { runtime.GOROOT(), runtime.Compiler, version, - GetBeegoVersion(), utils.GetLastPublishedTime(), }) if err != nil { diff --git a/cmd/commands/version/version.go b/cmd/commands/version/version.go index 238e7a7..6470d84 100644 --- a/cmd/commands/version/version.go +++ b/cmd/commands/version/version.go @@ -1,16 +1,12 @@ package version import ( - "bufio" "bytes" "encoding/json" "flag" "fmt" - "io" "os" "os/exec" - path "path/filepath" - "regexp" "runtime" "strings" @@ -30,7 +26,6 @@ const verboseVersionBanner string = `%s%s______ | |_/ /| __/| __/ \____/ \___| \___| v{{ .BeeVersion }}%s %s%s -├── Beego : {{ .BeegoVersion }} ├── GoVersion : {{ .GoVersion }} ├── GOOS : {{ .GOOS }} ├── GOARCH : {{ .GOARCH }} @@ -83,7 +78,6 @@ func versionCmd(cmd *commands.Command, args []string) int { runtime.GOROOT(), runtime.Compiler, version, - GetBeegoVersion(), utils.GetLastPublishedTime(), } switch outputFormat { @@ -120,52 +114,6 @@ func ShowShortVersionBanner() { InitBanner(output, bytes.NewBufferString(colors.MagentaBold(shortVersionBanner))) } -func GetBeegoVersion() string { - re, err := regexp.Compile(`VERSION = "([0-9.]+)"`) - if err != nil { - return "" - } - wgopath := utils.GetGOPATHs() - if len(wgopath) == 0 { - beeLogger.Log.Error("GOPATH environment is empty,may be you use `go module`") - return "" - } - for _, wg := range wgopath { - wg, _ = path.EvalSymlinks(path.Join(wg, "src", "github.com", "beego", "beego")) - filename := path.Join(wg, "beego.go") - _, err := os.Stat(filename) - if err != nil { - if os.IsNotExist(err) { - continue - } - beeLogger.Log.Error("Error while getting stats of 'beego.go'") - } - fd, err := os.Open(filename) - if err != nil { - beeLogger.Log.Error("Error while reading 'beego.go'") - continue - } - reader := bufio.NewReader(fd) - for { - byteLine, _, er := reader.ReadLine() - if er != nil && er != io.EOF { - return "" - } - if er == io.EOF { - break - } - line := string(byteLine) - s := re.FindStringSubmatch(line) - if len(s) >= 2 { - return s[1] - } - } - - } - return "Beego is not installed. Please do consider installing it first: https://github.com/beego/beego/v2. " + - "If you are using go mod, and you don't install the beego under $GOPATH/src/github.com/beego, just ignore this." -} - func GetGoVersion() string { var ( cmdOut []byte