1
0
mirror of https://github.com/beego/bee.git synced 2024-12-23 21:50:49 +00:00

Remove Beego version because when we use GO mod, we can not know specific project's beego version

This commit is contained in:
Ming Deng 2021-05-06 22:58:31 +08:00
parent 551d7cb8d3
commit 7b3d1b5f64
2 changed files with 0 additions and 54 deletions

View File

@ -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 {

View File

@ -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