Chore: format code
This commit is contained in:
parent
8f9eccefe9
commit
2b7401109f
@ -1,6 +1,7 @@
|
||||
# developing
|
||||
|
||||
- Lint: use golangci-lint. [4619](https://github.com/beego/beego/pull/4619)
|
||||
- Chore: format code. [4615](https://github.com/beego/beego/pull/4615)
|
||||
- Chore: update dependencies. [4611](https://github.com/beego/beego/pull/4611)
|
||||
- Update orm_test.go/TestInsertOrUpdate with table-driven. [4609](https://github.com/beego/beego/pull/4609)
|
||||
- Add: Resp() method for web.Controller. [4588](https://github.com/beego/beego/pull/4588)
|
||||
|
||||
1
adapter/cache/cache_test.go
vendored
1
adapter/cache/cache_test.go
vendored
@ -100,7 +100,6 @@ func TestCache(t *testing.T) {
|
||||
|
||||
assert.Equal(t, 2, len(vv))
|
||||
|
||||
|
||||
assert.Equal(t, "author", vv[0])
|
||||
|
||||
assert.Equal(t, "author1", vv[1])
|
||||
|
||||
@ -23,7 +23,6 @@ import (
|
||||
"github.com/beego/beego/v2/adapter/context"
|
||||
)
|
||||
|
||||
|
||||
// Demo is used to test, it's empty
|
||||
func Demo(i int) {
|
||||
|
||||
|
||||
@ -198,7 +198,6 @@ func TestMapGet(t *testing.T) {
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, int64(2), res)
|
||||
|
||||
|
||||
res, err = MapGet(m1, 1)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, int64(2), res)
|
||||
|
||||
3
client/cache/cache_test.go
vendored
3
client/cache/cache_test.go
vendored
@ -101,8 +101,6 @@ func TestCache(t *testing.T) {
|
||||
assert.Equal(t, "author", vv[0])
|
||||
assert.Equal(t, "author1", vv[1])
|
||||
|
||||
|
||||
|
||||
vv, err = bm.GetMulti(context.Background(), []string{"astaxie0", "astaxie1"})
|
||||
assert.Equal(t, 2, len(vv))
|
||||
assert.Nil(t, vv[0])
|
||||
@ -179,7 +177,6 @@ func testIncrDecr(t *testing.T, c Cache, beforeIncr interface{}, afterIncr inter
|
||||
assert.Nil(t, c.Put(ctx, key, beforeIncr, timeout))
|
||||
assert.Nil(t, c.Incr(ctx, key))
|
||||
|
||||
|
||||
v, _ := c.Get(ctx, key)
|
||||
assert.Equal(t, afterIncr, v)
|
||||
|
||||
|
||||
2
client/cache/calc_utils.go
vendored
2
client/cache/calc_utils.go
vendored
@ -12,8 +12,6 @@ var (
|
||||
ErrNotIntegerType = berror.Error(NotIntegerType, "item val is not (u)int (u)int32 (u)int64")
|
||||
)
|
||||
|
||||
|
||||
|
||||
func incr(originVal interface{}) (interface{}, error) {
|
||||
switch val := originVal.(type) {
|
||||
case int:
|
||||
|
||||
8
client/cache/error_code.go
vendored
8
client/cache/error_code.go
vendored
@ -123,14 +123,6 @@ var InvalidSsdbCacheValue = berror.DefineCode(4002022, moduleName, "InvalidSsdbC
|
||||
SSDB cache only accept string value. Please check your input.
|
||||
`)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var DeleteFileCacheItemFailed = berror.DefineCode(5002001, moduleName, "DeleteFileCacheItemFailed", `
|
||||
Beego try to delete file cache item failed.
|
||||
Please check whether Beego generated file correctly.
|
||||
|
||||
1
client/cache/memcache/memcache_test.go
vendored
1
client/cache/memcache/memcache_test.go
vendored
@ -86,7 +86,6 @@ func TestMemcacheCache(t *testing.T) {
|
||||
// test GetMulti
|
||||
assert.Nil(t, bm.Put(context.Background(), "astaxie1", "author1", timeoutDuration))
|
||||
|
||||
|
||||
res, _ = bm.IsExist(context.Background(), "astaxie1")
|
||||
assert.True(t, res)
|
||||
|
||||
|
||||
2
client/cache/redis/redis_test.go
vendored
2
client/cache/redis/redis_test.go
vendored
@ -40,7 +40,6 @@ func TestRedisCache(t *testing.T) {
|
||||
|
||||
assert.Nil(t, bm.Put(context.Background(), "astaxie", 1, timeoutDuration))
|
||||
|
||||
|
||||
res, _ := bm.IsExist(context.Background(), "astaxie")
|
||||
assert.True(t, res)
|
||||
|
||||
@ -51,7 +50,6 @@ func TestRedisCache(t *testing.T) {
|
||||
|
||||
assert.Nil(t, bm.Put(context.Background(), "astaxie", 1, timeoutDuration))
|
||||
|
||||
|
||||
val, _ := bm.Get(context.Background(), "astaxie")
|
||||
v, _ := redis.Int(val, err)
|
||||
assert.Equal(t, 1, v)
|
||||
|
||||
@ -56,6 +56,7 @@ import (
|
||||
)
|
||||
|
||||
const contentTypeKey = "Content-Type"
|
||||
|
||||
// it will be the last filter and execute request.Do
|
||||
var doRequestFilter = func(ctx context.Context, req *BeegoHTTPRequest) (*http.Response, error) {
|
||||
return req.doRequest(ctx)
|
||||
|
||||
@ -138,7 +138,6 @@ type txEnder interface {
|
||||
RollbackUnlessCommit() error
|
||||
}
|
||||
|
||||
|
||||
// Data Manipulation Language
|
||||
type DML interface {
|
||||
// insert model data to database
|
||||
@ -241,7 +240,6 @@ type DriverGetter interface {
|
||||
Driver() Driver
|
||||
}
|
||||
|
||||
|
||||
type ormer interface {
|
||||
DQL
|
||||
DML
|
||||
|
||||
@ -18,7 +18,6 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
)
|
||||
|
||||
func TestBeeLoggerDelLogger(t *testing.T) {
|
||||
|
||||
@ -436,6 +436,7 @@ func (c *Controller) URLFor(endpoint string, values ...interface{}) string {
|
||||
}
|
||||
return URLFor(endpoint, values...)
|
||||
}
|
||||
|
||||
// Resp sends response based on the Accept Header
|
||||
// By default response will be in JSON
|
||||
func (c *Controller) Resp(data interface{}) error {
|
||||
|
||||
@ -152,7 +152,6 @@ func (l *limiter) createBucket(key string) bucket {
|
||||
return b
|
||||
}
|
||||
|
||||
|
||||
func defaultSessionKey(r *http.Request) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ func (s *SessionProvider) SessionRegenerate(ctx context.Context, oldsid, sid str
|
||||
|
||||
// SessionDestroy reset Store to nil
|
||||
func (s *SessionProvider) SessionDestroy(ctx context.Context, sid string) error {
|
||||
s.Store = nil;
|
||||
s.Store = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -80,7 +80,6 @@ func (s *SessionProvider) SessionGC(ctx context.Context) {
|
||||
// we do anything since we don't need to mock GC
|
||||
}
|
||||
|
||||
|
||||
type SessionStore struct {
|
||||
sid string
|
||||
values map[interface{}]interface{}
|
||||
@ -120,6 +119,3 @@ func newSessionStore() *SessionStore {
|
||||
values: make(map[interface{}]interface{}, 4),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -45,4 +45,3 @@ func TestSessionProvider(t *testing.T) {
|
||||
|
||||
assert.Equal(t, "Tom", result)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user