Merge pull request #747 from flycash/updateMd

using beego v2
This commit is contained in:
Ming Deng 2020-12-14 13:20:03 +08:00 committed by GitHub
commit 642d933c4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 37 additions and 37 deletions

View File

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

View File

@ -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() {
@ -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}}
)
@ -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
`
@ -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() {
@ -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
@ -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
@ -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"
)

View File

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

View File

@ -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}}"
)

View File

@ -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() {
@ -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() {
@ -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
@ -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"
)
@ -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 {

View File

@ -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."
}

View File

@ -1023,7 +1023,7 @@ import (
"reflect"
"strings"
{{timePkg}}
"github.com/beego/beego/client/orm"
"github.com/beego/beego/v2/client/orm"
)
{{modelStruct}}
@ -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}}
@ -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() {

View File

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

View File

@ -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(
@ -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}}
)
@ -419,7 +419,7 @@ import (
"reflect"
"strings"
{{timePkg}}
"github.com/beego/beego/client/orm"
"github.com/beego/beego/v2/client/orm"
)
{{modelStruct}}

View File

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

View File

@ -145,7 +145,7 @@ import (
"reflect"
"strings"
{{timePkg}}
"github.com/beego/beego/client/orm"
"github.com/beego/beego/v2/client/orm"
)
{{modelStruct}}

View File

@ -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"
)
@ -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 != "" {

4
go.mod
View File

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

View File

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

View File

@ -14,4 +14,4 @@
package utils
const BEEGO_VERSION = "v1.12.4-0.20201213162117-e2a859d1564a"
const BEEGO_VERSION = "v2.0.0"