mirror of
https://github.com/kemko/reproxy.git
synced 2026-01-06 10:15:47 +03:00
pin golangci-lint version to latest available, fix reported errors
This commit is contained in:
committed by
Umputun
parent
cbed6ed705
commit
30173d599c
9
examples/plugin/vendor/github.com/go-pkgz/lgr/.golangci.yml
generated
vendored
9
examples/plugin/vendor/github.com/go-pkgz/lgr/.golangci.yml
generated
vendored
@@ -28,24 +28,21 @@ linters-settings:
|
||||
linters:
|
||||
enable:
|
||||
- megacheck
|
||||
- golint
|
||||
- revive
|
||||
- govet
|
||||
- unconvert
|
||||
- megacheck
|
||||
- structcheck
|
||||
- gas
|
||||
- gocyclo
|
||||
- dupl
|
||||
- misspell
|
||||
- unparam
|
||||
- varcheck
|
||||
- deadcode
|
||||
- unused
|
||||
- typecheck
|
||||
- ineffassign
|
||||
- varcheck
|
||||
- stylecheck
|
||||
- gochecknoinits
|
||||
- scopelint
|
||||
- exportloopref
|
||||
- gocritic
|
||||
- nakedret
|
||||
- gosimple
|
||||
|
||||
2
examples/plugin/vendor/github.com/go-pkgz/lgr/LICENSE
generated
vendored
2
examples/plugin/vendor/github.com/go-pkgz/lgr/LICENSE
generated
vendored
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Umputun
|
||||
Copyright (c) 2023 Umputun
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
5
examples/plugin/vendor/github.com/go-pkgz/lgr/go.mod
generated
vendored
5
examples/plugin/vendor/github.com/go-pkgz/lgr/go.mod
generated
vendored
@@ -1,5 +0,0 @@
|
||||
module github.com/go-pkgz/lgr
|
||||
|
||||
require github.com/stretchr/testify v1.6.1
|
||||
|
||||
go 1.15
|
||||
12
examples/plugin/vendor/github.com/go-pkgz/lgr/go.sum
generated
vendored
12
examples/plugin/vendor/github.com/go-pkgz/lgr/go.sum
generated
vendored
@@ -1,12 +0,0 @@
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
30
examples/plugin/vendor/github.com/go-pkgz/lgr/logger.go
generated
vendored
30
examples/plugin/vendor/github.com/go-pkgz/lgr/logger.go
generated
vendored
@@ -2,6 +2,7 @@
|
||||
// The logger's output can be customized in 2 ways:
|
||||
// - by setting individual formatting flags, i.e. lgr.New(lgr.Msec, lgr.CallerFunc)
|
||||
// - by passing formatting template, i.e. lgr.New(lgr.Format(lgr.Short))
|
||||
//
|
||||
// Leveled output works for messages based on text prefix, i.e. Logf("INFO some message") means INFO level.
|
||||
// Debug and trace levels can be filtered based on lgr.Trace and lgr.Debug options.
|
||||
// ERROR, FATAL and PANIC levels send to err as well. FATAL terminate caller application with os.Exit(1)
|
||||
@@ -51,6 +52,7 @@ var (
|
||||
type Logger struct {
|
||||
// set with Option calls
|
||||
stdout, stderr io.Writer // destination writes for out and err
|
||||
sameStream bool // stdout and stderr are the same stream
|
||||
dbg bool // allows reporting for DEBUG level
|
||||
trace bool // allows reporting for TRACE and DEBUG levels
|
||||
callerFile bool // reports caller file with line number, i.e. foo/bar.go:89
|
||||
@@ -128,6 +130,8 @@ func New(options ...Option) *Logger {
|
||||
res.callerOn = strings.Contains(res.format, "{{.Caller") || res.callerFile || res.callerFunc || res.callerPkg
|
||||
res.levelBracesOn = strings.Contains(res.format, "[{{.Level}}]") || res.levelBraces
|
||||
|
||||
res.sameStream = isStreamsSame(res.stdout, res.stderr)
|
||||
|
||||
return &res
|
||||
}
|
||||
|
||||
@@ -140,7 +144,7 @@ func (l *Logger) Logf(format string, args ...interface{}) {
|
||||
l.logf(format, args...)
|
||||
}
|
||||
|
||||
//nolint gocyclo
|
||||
// nolint gocyclo
|
||||
func (l *Logger) logf(format string, args ...interface{}) {
|
||||
|
||||
var lv, msg string
|
||||
@@ -197,7 +201,7 @@ func (l *Logger) logf(format string, args ...interface{}) {
|
||||
// write to err as well for high levels, exit(1) on fatal and panic and dump stack on panic level
|
||||
switch lv {
|
||||
case "ERROR":
|
||||
if l.stderr != l.stdout {
|
||||
if !l.sameStream {
|
||||
_, _ = l.stderr.Write(data)
|
||||
}
|
||||
if l.errorDump {
|
||||
@@ -210,12 +214,12 @@ func (l *Logger) logf(format string, args ...interface{}) {
|
||||
}
|
||||
}
|
||||
case "FATAL":
|
||||
if l.stderr != l.stdout {
|
||||
if !l.sameStream {
|
||||
_, _ = l.stderr.Write(data)
|
||||
}
|
||||
l.fatal()
|
||||
case "PANIC":
|
||||
if l.stderr != l.stdout {
|
||||
if !l.sameStream {
|
||||
_, _ = l.stderr.Write(data)
|
||||
}
|
||||
_, _ = l.stderr.Write(getDump())
|
||||
@@ -405,3 +409,21 @@ func getDump() []byte {
|
||||
}
|
||||
return stacktrace[:length]
|
||||
}
|
||||
|
||||
// isStreamsSame checks if two streams are the same by comparing file which they refer to
|
||||
func isStreamsSame(s1, s2 io.Writer) bool {
|
||||
s1File, outOk := s1.(*os.File)
|
||||
s2File, errOk := s2.(*os.File)
|
||||
if outOk && errOk {
|
||||
outStat, err := s1File.Stat()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
errStat, err := s2File.Stat()
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return os.SameFile(outStat, errStat)
|
||||
}
|
||||
return s1 == s2
|
||||
}
|
||||
|
||||
10
examples/plugin/vendor/github.com/go-pkgz/lgr/options.go
generated
vendored
10
examples/plugin/vendor/github.com/go-pkgz/lgr/options.go
generated
vendored
@@ -1,11 +1,14 @@
|
||||
package lgr
|
||||
|
||||
import "io"
|
||||
import (
|
||||
"io"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Option func type
|
||||
type Option func(l *Logger)
|
||||
|
||||
// Out sets out writer, stdout by default
|
||||
// Out sets output writer, stdout by default
|
||||
func Out(w io.Writer) Option {
|
||||
return func(l *Logger) {
|
||||
l.stdout = w
|
||||
@@ -74,6 +77,9 @@ func Msec(l *Logger) {
|
||||
func Secret(vals ...string) Option {
|
||||
return func(l *Logger) {
|
||||
for _, v := range vals {
|
||||
if strings.TrimSpace(v) == "" {
|
||||
continue // skip empty secrets
|
||||
}
|
||||
l.secrets = append(l.secrets, []byte(v))
|
||||
}
|
||||
}
|
||||
|
||||
5
examples/plugin/vendor/github.com/go-pkgz/repeater/go.mod
generated
vendored
5
examples/plugin/vendor/github.com/go-pkgz/repeater/go.mod
generated
vendored
@@ -1,5 +0,0 @@
|
||||
module github.com/go-pkgz/repeater
|
||||
|
||||
go 1.12
|
||||
|
||||
require github.com/stretchr/testify v1.3.0
|
||||
7
examples/plugin/vendor/github.com/go-pkgz/repeater/go.sum
generated
vendored
7
examples/plugin/vendor/github.com/go-pkgz/repeater/go.sum
generated
vendored
@@ -1,7 +0,0 @@
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
Reference in New Issue
Block a user