Skip to content

Commit

Permalink
Merge pull request #747 from flycash/updateMd
Browse files Browse the repository at this point in the history
using beego v2
  • Loading branch information
flycash authored Dec 14, 2020
2 parents c619ccf + c693549 commit 642d933
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ Breakpoint 1 set at 0x40100f for main.main() ./main.go:8
> main.main() ./main.go:8 (hits goroutine(1):1 total:1) (PC: 0x40100f)
3: import (
4: _ "github.com/user/myapp/routers"
5: beego "github.com/beego/beego/server/web"
5: beego "github.com/beego/beego/v2/server/web"
6: )
7:
=> 8: func main() {
Expand Down
18 changes: 9 additions & 9 deletions cmd/commands/api/apiapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var apiMaingo = `package main
import (
_ "{{.Appname}}/routers"
beego "github.com/beego/beego/server/web"
beego "github.com/beego/beego/v2/server/web"
)
func main() {
Expand All @@ -93,8 +93,8 @@ var apiMainconngo = `package main
import (
_ "{{.Appname}}/routers"
beego "github.com/beego/beego/server/web"
"github.com/beego/beego/client/orm"
beego "github.com/beego/beego/v2/server/web"
"github.com/beego/beego/v2/client/orm"
{{.DriverPkg}}
)
Expand All @@ -113,7 +113,7 @@ module %s
go %s
require github.com/beego/beego %s
require github.com/beego/beego/v2 %s
require github.com/smartystreets/goconvey v1.6.4
`

Expand All @@ -129,7 +129,7 @@ package routers
import (
"{{.Appname}}/controllers"
beego "github.com/beego/beego/server/web"
beego "github.com/beego/beego/v2/server/web"
)
func init() {
Expand Down Expand Up @@ -298,7 +298,7 @@ import (
"{{.Appname}}/models"
"encoding/json"
beego "github.com/beego/beego/server/web"
beego "github.com/beego/beego/v2/server/web"
)
// Operations about object
Expand Down Expand Up @@ -391,7 +391,7 @@ import (
"{{.Appname}}/models"
"encoding/json"
beego "github.com/beego/beego/server/web"
beego "github.com/beego/beego/v2/server/web"
)
// Operations about Users
Expand Down Expand Up @@ -516,8 +516,8 @@ import (
"path/filepath"
_ "{{.Appname}}/routers"
beego "github.com/beego/beego/server/web"
"github.com/beego/beego/core/logs"
beego "github.com/beego/beego/v2/server/web"
"github.com/beego/beego/v2/core/logs"
. "github.com/smartystreets/goconvey/convey"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/commands/hprose/hprose.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module %s
go %s
require github.com/beego/beego %s
require github.com/beego/beego/v2 %s
require github.com/smartystreets/goconvey v1.6.4
`

Expand Down
4 changes: 2 additions & 2 deletions cmd/commands/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ const (
import(
"os"
"github.com/beego/beego/client/orm"
"github.com/beego/beego/client/orm/migration"
"github.com/beego/beego/v2/client/orm"
"github.com/beego/beego/v2/client/orm/migration"
_ "{{DriverRepo}}"
)
Expand Down
10 changes: 5 additions & 5 deletions cmd/commands/new/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ var maingo = `package main
import (
_ "{{.Appname}}/routers"
beego "github.com/beego/beego/server/web"
beego "github.com/beego/beego/v2/server/web"
)
func main() {
Expand All @@ -82,7 +82,7 @@ var router = `package routers
import (
"{{.Appname}}/controllers"
beego "github.com/beego/beego/server/web"
beego "github.com/beego/beego/v2/server/web"
)
func init() {
Expand All @@ -93,7 +93,7 @@ var goMod = `module %s
go %s
require github.com/beego/beego %s
require github.com/beego/beego/v2 %s
require github.com/smartystreets/goconvey v1.6.4
`
var test = `package test
Expand All @@ -106,7 +106,7 @@ import (
"path/filepath"
_ "{{.Appname}}/routers"
beego "github.com/beego/beego/server/web"
beego "github.com/beego/beego/v2/server/web"
. "github.com/smartystreets/goconvey/convey"
)
Expand Down Expand Up @@ -140,7 +140,7 @@ func TestBeego(t *testing.T) {
var controllers = `package controllers
import (
beego "github.com/beego/beego/server/web"
beego "github.com/beego/beego/v2/server/web"
)
type MainController struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/commands/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func GetBeegoVersion() string {
}

}
return "Beego is not installed. Please do consider installing it first: https://github.com/beego/beego. " +
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/astaxie, just ignore this."
}

Expand Down
6 changes: 3 additions & 3 deletions generate/g_appcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ import (
"reflect"
"strings"
{{timePkg}}
"github.com/beego/beego/client/orm"
"github.com/beego/beego/v2/client/orm"
)
{{modelStruct}}
Expand Down Expand Up @@ -1172,7 +1172,7 @@ import (
"strconv"
"strings"
beego "github.com/beego/beego/server/web"
beego "github.com/beego/beego/v2/server/web"
)
// {{ctrlName}}Controller operations for {{ctrlName}}
Expand Down Expand Up @@ -1347,7 +1347,7 @@ package routers
import (
"{{pkgPath}}/controllers"
beego "github.com/beego/beego/server/web"
beego "github.com/beego/beego/v2/server/web"
)
func init() {
Expand Down
4 changes: 2 additions & 2 deletions generate/g_controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func GenerateController(cname, currpath string) {
var controllerTpl = `package {{packageName}}
import (
beego "github.com/beego/beego/server/web"
beego "github.com/beego/beego/v2/server/web"
)
// {{controllerName}}Controller operations for {{controllerName}}
Expand Down Expand Up @@ -166,7 +166,7 @@ import (
"strconv"
"strings"
beego "github.com/beego/beego/server/web"
beego "github.com/beego/beego/v2/server/web"
)
// {{controllerName}}Controller operations for {{controllerName}}
Expand Down
8 changes: 4 additions & 4 deletions generate/g_hproseappcode.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import (
"{{.Appname}}/models"
"github.com/hprose/hprose-golang/rpc"
beego "github.com/beego/beego/server/web"
beego "github.com/beego/beego/v2/server/web"
)
func logInvokeHandler(
Expand Down Expand Up @@ -90,8 +90,8 @@ import (
"{{.Appname}}/models"
"github.com/hprose/hprose-golang/rpc"
beego "github.com/beego/beego/server/web"
"github.com/beego/beego/client/orm"
beego "github.com/beego/beego/v2/server/web"
"github.com/beego/beego/v2/client/orm"
{{.DriverPkg}}
)
Expand Down Expand Up @@ -419,7 +419,7 @@ import (
"reflect"
"strings"
{{timePkg}}
"github.com/beego/beego/client/orm"
"github.com/beego/beego/v2/client/orm"
)
{{modelStruct}}
Expand Down
2 changes: 1 addition & 1 deletion generate/g_migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func GenerateMigration(mname, upsql, downsql, curpath string) {
const (
MigrationHeader = `package main
import (
"github.com/beego/beego/client/orm/migration"
"github.com/beego/beego/v2/client/orm/migration"
)
// DO NOT MODIFY
Expand Down
2 changes: 1 addition & 1 deletion generate/g_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ import (
"reflect"
"strings"
{{timePkg}}
"github.com/beego/beego/client/orm"
"github.com/beego/beego/v2/client/orm"
)
{{modelStruct}}
Expand Down
6 changes: 3 additions & 3 deletions generate/swaggergen/g_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ import (

yaml "gopkg.in/yaml.v2"

"github.com/beego/beego/server/web/swagger"
"github.com/beego/beego/core/utils"
"github.com/beego/beego/v2/server/web/swagger"
"github.com/beego/beego/v2/core/utils"
beeLogger "github.com/beego/bee/logger"
)

Expand Down Expand Up @@ -429,7 +429,7 @@ func analyseControllerPkg(localName, pkgpath string) {
if isSystemPackage(pkgpath) {
return
}
if pkgpath == "github.com/beego/beego/server/web" {
if pkgpath == "github.com/beego/beego/v2/server/web" {
return
}
if localName != "" {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/beego/bee
go 1.13

require (
github.com/beego/beego v1.12.4-0.20201213162117-e2a859d1564a
github.com/beego/beego/v2 v2.0.0
github.com/davecgh/go-spew v1.1.1
github.com/flosch/pongo2 v0.0.0-20200529170236-5abacdfa4915
github.com/fsnotify/fsnotify v1.4.9
Expand All @@ -17,4 +17,4 @@ require (
gopkg.in/yaml.v2 v2.3.0
)

//replace github.com/beego/beego => ../beego
//replace github.com/beego/beego/v2 => ../beego
2 changes: 1 addition & 1 deletion utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func IsInGOPATH(thePath string) bool {
// IsBeegoProject checks whether the current path is a Beego application or not
func IsBeegoProject(thePath string) bool {
mainFiles := []string{}
hasBeegoRegex := regexp.MustCompile(`(?s)package main.*?import.*?\(.*?github.com/beego/beego".*?\).*func main()`)
hasBeegoRegex := regexp.MustCompile(`(?s)package main.*?import.*?\(.*?github.com/beego/beego/v2".*?\).*func main()`)
c := make(chan error)
// Walk the application path tree to look for main files.
// Main files must satisfy the 'hasBeegoRegex' regular expression.
Expand Down
2 changes: 1 addition & 1 deletion utils/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

package utils

const BEEGO_VERSION = "v1.12.4-0.20201213162117-e2a859d1564a"
const BEEGO_VERSION = "v2.0.0"

0 comments on commit 642d933

Please sign in to comment.