Update dependencies and fix some linter warnings

This commit is contained in:
2022-08-28 02:23:36 +02:00
parent 0ed71be705
commit d2fa727990
14 changed files with 148 additions and 42 deletions

View File

@@ -77,7 +77,7 @@ func NewMetricsCollectingStore(ctx context.Context, store LoginAttemptStore) *Me
case <-ctx.Done():
return
case <-mcs.statsTicker.C:
mcs.Stats(LoginStatsTotals, 0)
mcs.Stats(LoginStatsTotals, 0) // nolint: errcheck
}
}
}()
@@ -116,7 +116,6 @@ func (s *MetricsCollectingStore) Stats(statType LoginStats, limit int) ([]StatsR
}
}
return stats, err
}
func (s *MetricsCollectingStore) Query(query AttemptQuery) ([]models.LoginAttempt, error) {

View File

@@ -53,7 +53,7 @@ RETURNING id;`
if err != nil {
return err
}
defer tx.Rollback()
defer tx.Rollback() // nolint: errcheck
var id int
if err := tx.QueryRow(stmt, l.Date, l.RemoteIP.String(), l.Username, l.Password, l.SSHClientVersion, l.ConnectionUUID, l.Country).Scan(&id); err != nil {

View File

@@ -1,3 +1,4 @@
// nolint: errcheck
package store_test
import (
@@ -27,6 +28,7 @@ func TestPostgresStore(t *testing.T) {
testLoginAttemptStore(s, t)
}
func TestPostgresStoreWithCache(t *testing.T) {
var dsn string
var found bool
@@ -47,6 +49,7 @@ func TestPostgresStoreWithCache(t *testing.T) {
testLoginAttemptStore(s, t)
}
func BenchmarkPostgresStore(b *testing.B) {
var dsn string
var found bool