From 7dfcee403e38868419ea03b3c044b4b9c31e1f8c Mon Sep 17 00:00:00 2001 From: Ada Date: Sat, 11 May 2024 00:42:58 +0200 Subject: [PATCH] :rotating_light: Fix linter error --- .golangci.yaml | 2 ++ internal/secret/crypto.go | 4 ++-- internal/utils/utils.go | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.golangci.yaml b/.golangci.yaml index e3bdba6..152a438 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -12,6 +12,8 @@ linters: - structcheck - exhaustivestruct - nosnakecase + - gomnd + - execinquery # Too extremist/unusable - depguard - varnamelen diff --git a/internal/secret/crypto.go b/internal/secret/crypto.go index 05276d9..e711b26 100644 --- a/internal/secret/crypto.go +++ b/internal/secret/crypto.go @@ -99,7 +99,7 @@ func VerifyPassword(password string, hash string) (bool, error) { // parseHash parse existing encoded argon2id string. func parseHash(source string) (argon2idHash, config, error) { separateItem := strings.Split(source, "$") - if len(separateItem) != 6 { //nolint:gomnd + if len(separateItem) != 6 { //nolint:mnd return argon2idHash{}, config{}, &parseError{message: "Hash format is not valid"} } @@ -108,7 +108,7 @@ func parseHash(source string) (argon2idHash, config, error) { } separateParam := strings.Split(separateItem[3], ",") - if len(separateParam) != 3 { //nolint:gomnd + if len(separateParam) != 3 { //nolint:mnd return argon2idHash{}, config{}, &parseError{message: "Hash config is not valid"} } diff --git a/internal/utils/utils.go b/internal/utils/utils.go index ecba2b5..f3f9ca5 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -45,7 +45,7 @@ func parseIntBeforeSeparator(source *string, sep string) (int, error) { // retur return 0, &parseIntBeforeSeparatorError{message: *source + ": format only take positive value"} } - if value > 99 { //nolint:gomnd + if value > 99 { //nolint:mnd return 0, &parseIntBeforeSeparatorError{message: *source + ": Format only take two number"} }