Apply goimports' modifications

This commit is contained in:
Jihoon Seo
2021-01-28 13:42:03 +09:00
parent 2bb6c45786
commit 113b90531c
34 changed files with 57 additions and 67 deletions

View File

@@ -15,10 +15,11 @@
package context
import (
"github.com/beego/beego/v2/server/web/session"
"net/http"
"net/http/httptest"
"testing"
"github.com/beego/beego/v2/server/web/session"
)
func TestXsrfReset_01(t *testing.T) {
@@ -68,4 +69,4 @@ func TestContext_Session2(t *testing.T) {
if store, err := c.Session(); store == nil || err != nil {
t.FailNow()
}
}
}

View File

@@ -53,4 +53,4 @@ func TestFilterChainBuilder_report(t *testing.T) {
ctx.Input.SetData("RouterPattern", "my-route")
report(time.Second, ctx, fb.buildVec())
}
}

View File

@@ -2,6 +2,7 @@ package session
import (
"context"
"github.com/beego/beego/v2/core/logs"
"github.com/beego/beego/v2/server/web"
webContext "github.com/beego/beego/v2/server/web/context"
@@ -32,4 +33,4 @@ func Session(providerType session.ProviderType, options ...session.ManagerConfig
next(ctx)
}
}
}
}

View File

@@ -1,13 +1,14 @@
package session
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/beego/beego/v2/server/web"
webContext "github.com/beego/beego/v2/server/web/context"
"github.com/beego/beego/v2/server/web/session"
"github.com/google/uuid"
"net/http"
"net/http/httptest"
"testing"
)
func testRequest(t *testing.T, handler *web.ControllerRegister, path string, method string, code int) {

View File

@@ -60,7 +60,6 @@ func TestControllerRegister_InsertFilterChain_Order(t *testing.T) {
}
})
InsertFilterChain("/abc", func(next FilterFunc) FilterFunc {
return func(ctx *context.Context) {
ctx.Output.Header("second", fmt.Sprintf("%d", time.Now().UnixNano()))

View File

@@ -70,7 +70,7 @@ var (
}
)
const commentFilename = "commentsRouter.go"
const commentFilename = "commentsRouter.go"
func init() {
pkgLastupdate = make(map[string]int64)

View File

@@ -22,7 +22,7 @@ import (
"github.com/stretchr/testify/assert"
)
func Test_getRouterDir(t *testing.T) {
func Test_getRouterDir(t *testing.T) {
pkg := filepath.Dir(os.TempDir())
res := getRouterDir(pkg)

View File

@@ -219,4 +219,4 @@ func TestManagerConfig_Opts(t *testing.T) {
if c.EnableSetCookie != true {
t.Error()
}
}
}

View File

@@ -342,7 +342,7 @@ func (t *Tree) match(treePattern string, pattern string, wildcardValues []string
if runObject == nil && len(t.fixrouters) > 0 {
// Filter the .json .xml .html extension
for _, str := range allowSuffixExt {
if strings.HasSuffix(seg, str) && strings.HasSuffix(treePattern, seg){
if strings.HasSuffix(seg, str) && strings.HasSuffix(treePattern, seg) {
for _, subTree := range t.fixrouters {
// strings.HasSuffix(treePattern, seg) avoid cases: /aaa.html/bbb could access /aaa/bbb
if subTree.prefix == seg[:len(seg)-len(str)] {