Skip to content

Commit 22ea0fa

Browse files
authored
Merge pull request #827 from beego/develop
Release v2.0.4
2 parents a75a0c8 + ef570ff commit 22ea0fa

File tree

6 files changed

+26
-83
lines changed

6 files changed

+26
-83
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ ______
6565
| |_/ / ___ ___
6666
| ___ \ / _ \ / _ \
6767
| |_/ /| __/| __/
68-
\____/ \___| \___| v2.0.3
68+
\____/ \___| \___| v2.0.4
6969

70-
├── Beego : 2.0.3
70+
├── Beego : 2.0.4
7171
├── GoVersion : go1.14.1
7272
├── GOOS : darwin
7373
├── GOARCH : amd64
@@ -90,8 +90,8 @@ $ bee version -o json
9090
"GOPATH": "/home/beeuser/.go",
9191
"GOROOT": "/usr/local/Cellar/go/1.14.1/libexec",
9292
"Compiler": "gc",
93-
"BeeVersion": "2.0.3",
94-
"BeegoVersion": "2.0.3",
93+
"BeeVersion": "2.0.4",
94+
"BeegoVersion": "2.0.4",
9595
"Published": "2020-09-13"
9696
}
9797
```

cmd/commands/version/banner.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ import (
1515

1616
// RuntimeInfo holds information about the current runtime.
1717
type RuntimeInfo struct {
18-
GoVersion string
19-
GOOS string
20-
GOARCH string
21-
NumCPU int
22-
GOPATH string
23-
GOROOT string
24-
Compiler string
25-
BeeVersion string
26-
Published string
18+
GoVersion string
19+
GOOS string
20+
GOARCH string
21+
NumCPU int
22+
GOPATH string
23+
GOROOT string
24+
Compiler string
25+
BeeVersion string
26+
Published string
2727
}
2828

2929
// InitBanner loads the banner and prints it to output
@@ -52,7 +52,7 @@ func show(out io.Writer, content string) {
5252
}
5353

5454
err = t.Execute(out, RuntimeInfo{
55-
GetGoVersion(),
55+
runtime.Version(),
5656
runtime.GOOS,
5757
runtime.GOARCH,
5858
runtime.NumCPU(),

cmd/commands/version/version.go

Lines changed: 8 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
package version
22

33
import (
4-
"bufio"
54
"bytes"
65
"encoding/json"
76
"flag"
87
"fmt"
98
"gopkg.in/yaml.v2"
10-
"io"
119
"os"
12-
path "path/filepath"
13-
"regexp"
1410
"runtime"
1511

1612
"github.com/beego/bee/v2/cmd/commands"
1713
"github.com/beego/bee/v2/config"
1814
beeLogger "github.com/beego/bee/v2/logger"
1915
"github.com/beego/bee/v2/logger/colors"
20-
"github.com/beego/bee/v2/utils"
2116
)
2217

2318
const verboseVersionBanner string = `%s%s______
@@ -27,7 +22,6 @@ const verboseVersionBanner string = `%s%s______
2722
| |_/ /| __/| __/
2823
\____/ \___| \___| v{{ .BeeVersion }}%s
2924
%s%s
30-
├── Beego : {{ .BeegoVersion }}
3125
├── GoVersion : {{ .GoVersion }}
3226
├── GOOS : {{ .GOOS }}
3327
├── GOARCH : {{ .GOARCH }}
@@ -72,15 +66,14 @@ func versionCmd(cmd *commands.Command, args []string) int {
7266

7367
if outputFormat != "" {
7468
runtimeInfo := RuntimeInfo{
75-
GetGoVersion(),
76-
runtime.GOOS,
77-
runtime.GOARCH,
78-
runtime.NumCPU(),
79-
os.Getenv("GOPATH"),
80-
runtime.GOROOT(),
81-
runtime.Compiler,
82-
version,
83-
GetBeegoVersion(),
69+
GoVersion: runtime.Version(),
70+
GOOS: runtime.GOOS,
71+
GOARCH: runtime.GOARCH,
72+
NumCPU: runtime.NumCPU(),
73+
GOPATH: os.Getenv("GOPATH"),
74+
GOROOT: runtime.GOROOT(),
75+
Compiler: runtime.Compiler,
76+
BeeVersion: version,
8477
}
8578
switch outputFormat {
8679
case "json":
@@ -115,53 +108,3 @@ func ShowShortVersionBanner() {
115108
output := colors.NewColorWriter(os.Stdout)
116109
InitBanner(output, bytes.NewBufferString(colors.MagentaBold(shortVersionBanner)))
117110
}
118-
119-
func GetBeegoVersion() string {
120-
re, err := regexp.Compile(`VERSION = "([0-9.]+)"`)
121-
if err != nil {
122-
return ""
123-
}
124-
wgopath := utils.GetGOPATHs()
125-
if len(wgopath) == 0 {
126-
beeLogger.Log.Error("GOPATH environment is empty,may be you use `go module`")
127-
return ""
128-
}
129-
for _, wg := range wgopath {
130-
wg, _ = path.EvalSymlinks(path.Join(wg, "src", "github.com", "astaxie", "beego"))
131-
filename := path.Join(wg, "beego.go")
132-
_, err := os.Stat(filename)
133-
if err != nil {
134-
if os.IsNotExist(err) {
135-
continue
136-
}
137-
beeLogger.Log.Error("Error while getting stats of 'beego.go'")
138-
}
139-
fd, err := os.Open(filename)
140-
if err != nil {
141-
beeLogger.Log.Error("Error while reading 'beego.go'")
142-
continue
143-
}
144-
reader := bufio.NewReader(fd)
145-
for {
146-
byteLine, _, er := reader.ReadLine()
147-
if er != nil && er != io.EOF {
148-
return ""
149-
}
150-
if er == io.EOF {
151-
break
152-
}
153-
line := string(byteLine)
154-
s := re.FindStringSubmatch(line)
155-
if len(s) >= 2 {
156-
return s[1]
157-
}
158-
}
159-
160-
}
161-
return "Beego is not installed. Please do consider installing it first: https://github.com/beego/beego/v2. " +
162-
"If you are using go mod, and you don't install the beego under $GOPATH/src/github.com/astaxie, just ignore this."
163-
}
164-
165-
func GetGoVersion() string {
166-
return runtime.Version()
167-
}

config/conf.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
const confVer = 0
2828

2929
const (
30-
Version = "2.0.2"
30+
Version = "2.0.4"
3131
GitRemotePath = "github.com/beego/bee/v2"
3232
)
3333

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/beego/bee/v2
33
go 1.18
44

55
require (
6-
github.com/beego/beego/v2 v2.0.3
6+
github.com/beego/beego/v2 v2.0.4
77
github.com/davecgh/go-spew v1.1.1
88
github.com/flosch/pongo2 v0.0.0-20200529170236-5abacdfa4915
99
github.com/fsnotify/fsnotify v1.4.9

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5
4343
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
4444
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
4545
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
46-
github.com/beego/beego/v2 v2.0.3 h1:vLrjDsn3JcxvIUqduDs4i0BdWuu5v7YN2FRKQcTWIDI=
47-
github.com/beego/beego/v2 v2.0.3/go.mod h1:svcOCy6uDaGYHwcO3nppzKwFigeXm8WHkZfgnvemYNM=
46+
github.com/beego/beego/v2 v2.0.4 h1:1NjpVkcqYVdKE06VJTQUVzsgZqFcaj0MqjHna57bWsA=
47+
github.com/beego/beego/v2 v2.0.4/go.mod h1:21YTlo+jRYqrM/dLC0knzmo9C25x0pqddoKqy8kxev8=
4848
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
4949
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
5050
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=

0 commit comments

Comments
 (0)