From ead65abfaab19dfef6fafd310af7ac8f6a3e9c07 Mon Sep 17 00:00:00 2001 From: Aryan Date: Tue, 24 Dec 2024 21:31:05 +0530 Subject: [PATCH] Fixes linting issues and bump linter version to 1.62.2 --- Makefile | 2 +- golangci.yaml | 30 +++++++++++++++--------------- helper/random.go | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 6ba5fb6..5caacb3 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ install-golangci-lint: @echo "=====> Installing golangci-lint..." @curl -sSfL \ https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | \ - sh -s -- -b $(GOPATH_BIN) v1.52.2 + sh -s -- -b $(GOPATH_BIN) v1.62.2 lint: install-golangci-lint @$(GO) vet $(GO_PACKAGES) diff --git a/golangci.yaml b/golangci.yaml index 3f7d126..855c5e7 100644 --- a/golangci.yaml +++ b/golangci.yaml @@ -1,22 +1,22 @@ linters: disable-all: true enable: - - govet - - staticcheck - - unused - - gosimple - - revive - - unconvert - - goconst - - gocyclo - - gofmt - - goimports - - misspell - - lll + - govet + - staticcheck + - unused + - gosimple + - revive + - unconvert + - goconst + - gocyclo + - gofmt + - goimports + - misspell + - lll linters-settings: govet: - check-shadowing: true + shadow: true errcheck: check-type-assertions: true @@ -41,8 +41,8 @@ linters-settings: gocyclo: min-complexity: 20 - + revive: ignore-generated-header: true ignore-patterns: - - "_" \ No newline at end of file + - "_" diff --git a/helper/random.go b/helper/random.go index 4fd7ebb..e569ff1 100644 --- a/helper/random.go +++ b/helper/random.go @@ -9,11 +9,11 @@ import ( const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" func RandomString(n int) string { - rand.Seed(time.Now().UnixNano()) + r := rand.New(rand.NewSource(time.Now().UnixNano())) sb := strings.Builder{} sb.Grow(n) for i := 0; i < n; i++ { - sb.WriteByte(charset[rand.Intn(len(charset))]) + sb.WriteByte(charset[r.Intn(len(charset))]) } return sb.String() }