Lint
continuous-integration/drone/push Build is failing Details

master
Андрей Иванов 2024-09-10 13:14:13 +03:00
parent 23b53d352e
commit 1850093a07
4 changed files with 9 additions and 17 deletions

View File

@ -74,7 +74,6 @@ linters:
enable-all: true
disable:
- gci
- exhaustivestruct
- exhaustruct
- gochecknoglobals
- whitespace
@ -83,21 +82,13 @@ linters:
- nlreturn
- gofmt
- gofumpt
- varcheck
- golint
- structcheck
- nosnakecase
- maligned
- interfacer
- deadcode
- scopelint
- ifshort
- godox
- forbidigo
- goerr113
- err113
- nonamedreturns
- staticcheck
- depguard
- intrange #Пока не пересели на go1.22+
fast: false
issues:

View File

@ -2,6 +2,7 @@ package config
import (
"database/sql"
"errors"
"fmt"
"io/ioutil"
"os"
@ -98,7 +99,7 @@ func DialDSN(dsn string) (db *sql.DB, dbname string, err error) {
driver = "mysql"
dsn = strings.TrimLeft(dsn, "mysql://")
default:
return nil, "", fmt.Errorf("can't use unknown SQL dialect")
return nil, "", errors.New("can't use unknown SQL dialect")
}
db, err = sql.Open(driver, dsn)
@ -116,7 +117,7 @@ func (s Interface) SetFromDB(database *sql.DB, _ string) error {
// TODO: Перенести это в параметры.
table := "config"
q := "SELECT " + table + ".key, " + table + ".value FROM " + table
q := fmt.Sprintf("SELECT %s.key, %s.value FROM %s", table, table, table)
results, err := database.Query(q)
if err != nil || results.Err() != nil {
return fmt.Errorf("can't get key-value pairs from DB: %w", err)

View File

@ -1,6 +1,7 @@
package config
import (
"errors"
"fmt"
"os"
"reflect"
@ -10,7 +11,7 @@ import (
func getEnvVar(value reflect.Value, rtype reflect.Type, counter int, prefix string) error {
if value.Kind() != reflect.Ptr {
return fmt.Errorf("not a pointer value")
return errors.New("not a pointer value")
}
f := reflect.StructField{}
if counter != -1 {
@ -38,7 +39,7 @@ func getEnvVar(value reflect.Value, rtype reflect.Type, counter int, prefix stri
func parseToStruct(value reflect.Value, rtype reflect.Type, counter int, prefix string, index map[string]string) error {
if value.Kind() != reflect.Ptr {
return fmt.Errorf("not a pointer value")
return errors.New("not a pointer value")
}
f := reflect.StructField{}
if counter != -1 {

View File

@ -71,6 +71,5 @@ func (l *Logger) Errorf(format string, args ...interface{}) {
func (l *Logger) Fatalf(format string, args ...interface{}) {
l.Logger.Fatalf(format, args)
//nolint:gomnd
os.Exit(2)
os.Exit(2) //nolint:mnd
}