Fix lint and format code in adapter dir
This commit is contained in:
parent
ca328208cc
commit
3572ac96a4
@ -1,12 +1,9 @@
|
||||
# developing
|
||||
|
||||
- Fix lint and format code in adapter/config dir [4646](https://github.com/beego/beego/pull/4646)
|
||||
- Add http client and option func. [4455](https://github.com/beego/beego/issues/4455)
|
||||
- Add: Convenient way to generate mock object [4620](https://github.com/beego/beego/issues/4620)
|
||||
- Fix lint and format code in adapter/context dir [4647](https://github.com/beego/beego/pull/4647)
|
||||
- Infra: use dependabot to update dependencies. [4623](https://github.com/beego/beego/pull/4623)
|
||||
- Lint: use golangci-lint. [4619](https://github.com/beego/beego/pull/4619)
|
||||
- Fix lint and format code in adapter/httplib dir [4648](https://github.com/beego/beego/pull/4648)
|
||||
- Chore: format code. [4615](https://github.com/beego/beego/pull/4615)
|
||||
- Test on Go v1.15.x & v1.16.x. [4614](https://github.com/beego/beego/pull/4614)
|
||||
- Env: non-empty GOBIN & GOPATH. [4613](https://github.com/beego/beego/pull/4613)
|
||||
@ -53,7 +50,6 @@
|
||||
- Init exceptMethod by using reflection. [4583](https://github.com/beego/beego/pull/4583)
|
||||
- Deprecated BeeMap and replace all usage with `sync.map` [4616](https://github.com/beego/beego/pull/4616)
|
||||
- TaskManager support graceful shutdown [4635](https://github.com/beego/beego/pull/4635)
|
||||
- Fix lint and format code in adapter/cache dir [4645](https://github.com/beego/beego/pull/4645)
|
||||
|
||||
## Fix Sonar
|
||||
|
||||
@ -67,3 +63,8 @@
|
||||
## Fix lint and format code
|
||||
|
||||
- [4644](https://github.com/beego/beego/pull/4644)
|
||||
- [4645](https://github.com/beego/beego/pull/4645)
|
||||
- [4646](https://github.com/beego/beego/pull/4646)
|
||||
- [4647](https://github.com/beego/beego/pull/4647)
|
||||
- [4648](https://github.com/beego/beego/pull/4648)
|
||||
- [4649](https://github.com/beego/beego/pull/4649)
|
||||
|
||||
@ -22,10 +22,8 @@ import (
|
||||
"github.com/beego/beego/v2/server/web/context"
|
||||
)
|
||||
|
||||
var (
|
||||
// BeeApp is an application instance
|
||||
BeeApp *App
|
||||
)
|
||||
// BeeApp is an application instance
|
||||
var BeeApp *App
|
||||
|
||||
func init() {
|
||||
// create beego application
|
||||
|
||||
@ -36,10 +36,6 @@ type M web.M
|
||||
// Hook function to run
|
||||
type hookfunc func() error
|
||||
|
||||
var (
|
||||
hooks = make([]hookfunc, 0) // hook function slice to store the hookfunc
|
||||
)
|
||||
|
||||
// AddAPPStartHook is used to register the hookfunc
|
||||
// The hookfuncs will run in beego.Run()
|
||||
// such as initiating session , starting middleware , building template, starting admin control and so on.
|
||||
|
||||
@ -48,9 +48,11 @@ type ControllerCommentsSlice web.ControllerCommentsSlice
|
||||
func (p ControllerCommentsSlice) Len() int {
|
||||
return (web.ControllerCommentsSlice)(p).Len()
|
||||
}
|
||||
|
||||
func (p ControllerCommentsSlice) Less(i, j int) bool {
|
||||
return (web.ControllerCommentsSlice)(p).Less(i, j)
|
||||
}
|
||||
|
||||
func (p ControllerCommentsSlice) Swap(i, j int) {
|
||||
(web.ControllerCommentsSlice)(p).Swap(i, j)
|
||||
}
|
||||
|
||||
@ -18,7 +18,5 @@ import (
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
)
|
||||
|
||||
var (
|
||||
// ErrMissPK missing pk error
|
||||
ErrMissPK = orm.ErrMissPK
|
||||
)
|
||||
// ErrMissPK missing pk error
|
||||
var ErrMissPK = orm.ErrMissPK
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
// Copyright 2020
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package orm
|
||||
|
||||
import (
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
)
|
||||
|
||||
type baseQuerySetter struct {
|
||||
}
|
||||
|
||||
const shouldNotInvoke = "you should not invoke this method."
|
||||
|
||||
func (b *baseQuerySetter) ForceIndex(indexes ...string) orm.QuerySeter {
|
||||
panic(shouldNotInvoke)
|
||||
}
|
||||
|
||||
func (b *baseQuerySetter) UseIndex(indexes ...string) orm.QuerySeter {
|
||||
panic(shouldNotInvoke)
|
||||
}
|
||||
|
||||
func (b *baseQuerySetter) IgnoreIndex(indexes ...string) orm.QuerySeter {
|
||||
panic(shouldNotInvoke)
|
||||
}
|
||||
@ -72,5 +72,4 @@ func TestRedisSentinel(t *testing.T) {
|
||||
assert.Nil(t, password)
|
||||
|
||||
sess.SessionRelease(w)
|
||||
|
||||
}
|
||||
|
||||
@ -22,14 +22,14 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const sid = "Session_id"
|
||||
const sidNew = "Session_id_new"
|
||||
const sessionPath = "./_session_runtime"
|
||||
|
||||
var (
|
||||
mutex sync.Mutex
|
||||
const (
|
||||
sid = "Session_id"
|
||||
sidNew = "Session_id_new"
|
||||
sessionPath = "./_session_runtime"
|
||||
)
|
||||
|
||||
var mutex sync.Mutex
|
||||
|
||||
func TestFileProviderSessionExist(t *testing.T) {
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
|
||||
@ -118,7 +118,6 @@ func AssetsJs(text string) template.HTML {
|
||||
|
||||
// AssetsCSS returns stylesheet link tag with src string.
|
||||
func AssetsCSS(text string) template.HTML {
|
||||
|
||||
text = "<link href=\"" + text + "\" rel=\"stylesheet\" />"
|
||||
|
||||
return template.HTML(text)
|
||||
|
||||
@ -79,7 +79,6 @@ func TestHtmlunquote(t *testing.T) {
|
||||
h := `<' ”“&">`
|
||||
s := `<' ”“&">`
|
||||
assert.Equal(t, s, Htmlunquote(h))
|
||||
|
||||
}
|
||||
|
||||
func TestParseForm(t *testing.T) {
|
||||
@ -234,5 +233,4 @@ func TestMapGet(t *testing.T) {
|
||||
res, err = MapGet(m5, 5, 4, 3, 2, 1)
|
||||
assert.Nil(t, err)
|
||||
assert.Nil(t, res)
|
||||
|
||||
}
|
||||
|
||||
@ -14,12 +14,7 @@
|
||||
|
||||
package testing
|
||||
|
||||
import (
|
||||
"github.com/beego/beego/v2/client/httplib/testing"
|
||||
)
|
||||
|
||||
var port = ""
|
||||
var baseURL = "http://localhost:"
|
||||
import "github.com/beego/beego/v2/client/httplib/testing"
|
||||
|
||||
// TestHTTPRequest beego test request client
|
||||
type TestHTTPRequest testing.TestHTTPRequest
|
||||
|
||||
@ -16,19 +16,10 @@ package toolbox
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/beego/beego/v2/core/admin"
|
||||
)
|
||||
|
||||
var startTime = time.Now()
|
||||
var pid int
|
||||
|
||||
func init() {
|
||||
pid = os.Getpid()
|
||||
}
|
||||
|
||||
// ProcessInput parse input command string
|
||||
func ProcessInput(input string, w io.Writer) {
|
||||
admin.ProcessInput(input, w)
|
||||
|
||||
@ -80,7 +80,6 @@ type Task struct {
|
||||
|
||||
// NewTask add new task with name, time and func
|
||||
func NewTask(tname string, spec string, f TaskFunc) *Task {
|
||||
|
||||
task := task.NewTask(tname, spec, func(ctx context.Context) error {
|
||||
return f()
|
||||
})
|
||||
@ -98,7 +97,6 @@ func (t *Task) GetSpec() string {
|
||||
|
||||
// GetStatus get current task status
|
||||
func (t *Task) GetStatus() string {
|
||||
|
||||
t.initDelegate()
|
||||
|
||||
return t.delegate.GetStatus(context.Background())
|
||||
@ -222,7 +220,6 @@ type MapSorter task.MapSorter
|
||||
|
||||
// NewMapSorter create new tasker map
|
||||
func NewMapSorter(m map[string]Tasker) *MapSorter {
|
||||
|
||||
newTaskerMap := make(map[string]task.Tasker, len(m))
|
||||
|
||||
for key, value := range m {
|
||||
@ -249,6 +246,7 @@ func (ms *MapSorter) Less(i, j int) bool {
|
||||
}
|
||||
return ms.Vals[i].GetNext(context.Background()).Before(ms.Vals[j].GetNext(context.Background()))
|
||||
}
|
||||
|
||||
func (ms *MapSorter) Swap(i, j int) {
|
||||
ms.Vals[i], ms.Vals[j] = ms.Vals[j], ms.Vals[i]
|
||||
ms.Keys[i], ms.Keys[j] = ms.Keys[j], ms.Keys[i]
|
||||
|
||||
@ -69,9 +69,7 @@ import (
|
||||
beecontext "github.com/beego/beego/v2/server/web/context"
|
||||
)
|
||||
|
||||
var (
|
||||
defaultChars = []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
|
||||
)
|
||||
var defaultChars = []byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
|
||||
|
||||
const (
|
||||
// default captcha attributes
|
||||
|
||||
@ -28,8 +28,8 @@ func TestPrint(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPrintPoint(t *testing.T) {
|
||||
var v1 = new(mytype)
|
||||
var v2 = new(mytype)
|
||||
v1 := new(mytype)
|
||||
v2 := new(mytype)
|
||||
|
||||
v1.prev = nil
|
||||
v1.next = v2
|
||||
|
||||
@ -19,6 +19,7 @@ import (
|
||||
)
|
||||
|
||||
type reducetype func(interface{}) interface{}
|
||||
|
||||
type filtertype func(interface{}) bool
|
||||
|
||||
// InSlice checks given string in string slice or not.
|
||||
|
||||
@ -27,9 +27,7 @@ const (
|
||||
LabelTag = validation.LabelTag
|
||||
)
|
||||
|
||||
var (
|
||||
ErrInt64On32 = validation.ErrInt64On32
|
||||
)
|
||||
var ErrInt64On32 = validation.ErrInt64On32
|
||||
|
||||
// CustomFunc is for custom validate function
|
||||
type CustomFunc func(v *Validation, obj interface{}, key string)
|
||||
|
||||
@ -50,7 +50,6 @@ func TestMin(t *testing.T) {
|
||||
|
||||
assert.False(t, valid.Min(-1, 0, "min0").Ok)
|
||||
assert.True(t, valid.Min(1, 0, "min0").Ok)
|
||||
|
||||
}
|
||||
|
||||
func TestMax(t *testing.T) {
|
||||
@ -502,5 +501,4 @@ func TestCanSkipAlso(t *testing.T) {
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.True(t, b)
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user