update golint
This commit is contained in:
@@ -37,6 +37,17 @@ linters-settings:
|
||||
|
||||
linters:
|
||||
enable-all: true
|
||||
disable:
|
||||
- exhaustivestruct
|
||||
- maligned
|
||||
- deadcode
|
||||
- interfacer
|
||||
- golint
|
||||
- varcheck
|
||||
- nosnakecase
|
||||
- scopelint
|
||||
- ifshort
|
||||
- structcheck
|
||||
|
||||
issues:
|
||||
# Excluding configuration per-path, per-linter, per-text and per-source
|
||||
@@ -44,5 +55,5 @@ issues:
|
||||
- path: _test\.go
|
||||
linters:
|
||||
- gomnd
|
||||
- exhaustivestruct
|
||||
- ireturn
|
||||
- exhaustruct
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"gitoa.ru/go-4devs/log/field"
|
||||
)
|
||||
|
||||
// nolint: gochecknoglobals
|
||||
//nolint:gochecknoglobals
|
||||
var (
|
||||
errExample = errors.New("fail")
|
||||
_messages = fakeMessages(1000)
|
||||
@@ -118,7 +118,7 @@ func fakeSugarFields() []interface{} {
|
||||
}
|
||||
|
||||
func NewLogger() log.Logger {
|
||||
return log.New(log.WithWriter(ioutil.Discard))
|
||||
return log.New(log.WithWriter(io.Discard))
|
||||
}
|
||||
|
||||
func BenchmarkDisabledWithoutFields(b *testing.B) {
|
||||
|
||||
@@ -2,14 +2,14 @@ package entry
|
||||
|
||||
import "sync"
|
||||
|
||||
// nolint: gochecknoglobals
|
||||
//nolint:gochecknoglobals
|
||||
var pool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
return New()
|
||||
},
|
||||
}
|
||||
|
||||
//nolint: forcetypeassert
|
||||
//nolint:forcetypeassert
|
||||
func Get() *Entry {
|
||||
e := pool.Get().(*Entry)
|
||||
e.Reset()
|
||||
|
||||
@@ -2,6 +2,7 @@ package field
|
||||
|
||||
import "time"
|
||||
|
||||
//nolint:interfacebloat
|
||||
type Encoder interface {
|
||||
// Built-in types.
|
||||
AddArray(key string, value Value)
|
||||
|
||||
@@ -255,13 +255,13 @@ type Field struct {
|
||||
value Value
|
||||
}
|
||||
|
||||
//nolint: gocyclo,cyclop
|
||||
//nolint:gocyclo,cyclop
|
||||
func (f Field) AddTo(enc Encoder) {
|
||||
key := string(f.key)
|
||||
|
||||
switch {
|
||||
case f.value.IsArray():
|
||||
enc.AddAny(key, f.value)
|
||||
enc.AddArray(key, f.value)
|
||||
case f.value.IsNil():
|
||||
enc.AddNil(key)
|
||||
case f.value.IsBool():
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
type Key string
|
||||
|
||||
//nolint: gocyclo,funlen,cyclop
|
||||
//nolint:funlen,cyclop,gocyclo
|
||||
func (k Key) Any(value interface{}) Field {
|
||||
switch val := value.(type) {
|
||||
case string:
|
||||
|
||||
@@ -24,7 +24,7 @@ func (v Value) MarshalJSON() ([]byte, error) {
|
||||
return b, nil
|
||||
}
|
||||
|
||||
//nolint: gocyclo,gomnd,cyclop
|
||||
//nolint:gocyclo,gomnd,cyclop
|
||||
func (v Value) String() string {
|
||||
switch {
|
||||
case v.vtype.IsArray(), v.vtype.IsAny():
|
||||
@@ -62,7 +62,7 @@ func (v Value) String() string {
|
||||
return fmt.Sprintf("%+v", v.AsInterface())
|
||||
}
|
||||
|
||||
//nolint: gocyclo,cyclop
|
||||
//nolint:gocyclo,cyclop
|
||||
func (v Value) AsInterface() interface{} {
|
||||
switch {
|
||||
case v.vtype.IsArray():
|
||||
|
||||
@@ -306,7 +306,7 @@ func (l Logger) Writer(ctx context.Context, level level.Level, fields ...field.F
|
||||
}
|
||||
}
|
||||
|
||||
//nolint: containedctx
|
||||
//nolint:containedctx
|
||||
type writer struct {
|
||||
ctx context.Context
|
||||
level level.Level
|
||||
|
||||
@@ -76,7 +76,7 @@ func WithJSONFormat() Option {
|
||||
return WithEncode(jsonFormat)
|
||||
}
|
||||
|
||||
//nolint: forcetypeassert
|
||||
//nolint:forcetypeassert
|
||||
func stringFormat() func(entry *entry.Entry) ([]byte, error) {
|
||||
pool := sync.Pool{
|
||||
New: func() interface{} {
|
||||
|
||||
Reference in New Issue
Block a user