Fix lint issues reported by staticcheck
Used staticcheck 2022.1.2 (v0.3.2) See: staticcheck.io
This commit is contained in:
@@ -465,17 +465,13 @@ func getMapping(mask encoder.MultiEncoder) mapping {
|
||||
}
|
||||
func collectEncodables(m []mapping) (out []rune) {
|
||||
for _, s := range m {
|
||||
for _, r := range s.src {
|
||||
out = append(out, r)
|
||||
}
|
||||
out = append(out, s.src...)
|
||||
}
|
||||
return
|
||||
}
|
||||
func collectEncoded(m []mapping) (out []rune) {
|
||||
for _, s := range m {
|
||||
for _, r := range s.dst {
|
||||
out = append(out, r)
|
||||
}
|
||||
out = append(out, s.dst...)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ func TestKvConcurrency(t *testing.T) {
|
||||
require.Equal(t, 0, len(dbMap), "no databases can be started initially")
|
||||
|
||||
const threadNum = 5
|
||||
const facility = "test"
|
||||
var wg sync.WaitGroup
|
||||
ctx := context.Background()
|
||||
results := make([]*DB, threadNum)
|
||||
@@ -55,7 +54,6 @@ func TestKvConcurrency(t *testing.T) {
|
||||
func TestKvExit(t *testing.T) {
|
||||
require.Equal(t, 0, len(dbMap), "no databases can be started initially")
|
||||
const dbNum = 5
|
||||
const openNum = 2
|
||||
ctx := context.Background()
|
||||
for i := 0; i < dbNum; i++ {
|
||||
facility := fmt.Sprintf("test-%d", i)
|
||||
|
||||
@@ -280,7 +280,7 @@ func (ts *TokenSource) timeToExpiry() time.Duration {
|
||||
if t.Expiry.IsZero() {
|
||||
return 3e9 * time.Second // ~95 years
|
||||
}
|
||||
return t.Expiry.Sub(time.Now())
|
||||
return time.Until(t.Expiry)
|
||||
}
|
||||
|
||||
// OnExpiry returns a channel which has the time written to it when
|
||||
@@ -766,7 +766,6 @@ func (s *authServer) Init() error {
|
||||
}
|
||||
fs.Debugf(nil, "Redirecting browser to: %s", s.authURL)
|
||||
http.Redirect(w, req, s.authURL, http.StatusTemporaryRedirect)
|
||||
return
|
||||
})
|
||||
mux.HandleFunc("/", s.handleAuth)
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ func NewTokenDispenser(n int) *TokenDispenser {
|
||||
// Get gets a token from the pool - don't forget to return it with Put
|
||||
func (td *TokenDispenser) Get() {
|
||||
<-td.tokens
|
||||
return
|
||||
}
|
||||
|
||||
// Put returns a token
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
|
||||
const versionFormat = "-v2006-01-02-150405.000"
|
||||
|
||||
var versionRegexp = regexp.MustCompile("-v\\d{4}-\\d{2}-\\d{2}-\\d{6}-\\d{3}")
|
||||
var versionRegexp = regexp.MustCompile(`-v\d{4}-\d{2}-\d{2}-\d{6}-\d{3}`)
|
||||
|
||||
// Split fileName into base and extension so that base + ext == fileName
|
||||
func splitExt(fileName string) (base, ext string) {
|
||||
|
||||
Reference in New Issue
Block a user