File tree Expand file tree Collapse file tree 3 files changed +45
-16
lines changed
Expand file tree Collapse file tree 3 files changed +45
-16
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,39 @@ linters-settings:
1010 - octalLiteral
1111 govet :
1212 check-shadowing : true
13- golint :
14- min-confidence : 0
13+ revive :
14+ # see https://github.com/mgechev/revive#available-rules for details.
15+ ignore-generated-header : true
16+ severity : warning
17+ rules :
18+ - name : blank-imports
19+ - name : context-as-argument
20+ - name : context-keys-type
21+ - name : dot-imports
22+ - name : error-return
23+ - name : error-strings
24+ - name : error-naming
25+ - name : errorf
26+ - name : exported
27+ - name : indent-error-flow
28+ - name : if-return
29+ - name : increment-decrement
30+ - name : var-naming
31+ - name : var-declaration
32+ - name : package-comments
33+ - name : range
34+ - name : receiver-naming
35+ - name : time-naming
36+ - name : unexported-return
37+ - name : indent-error-flow
38+ - name : errorf
39+ - name : empty-block
40+ - name : superfluous-else
41+ - name : struct-tag
42+ # Too many unusued parameters, skipping this check for now
43+ # - name: unused-parameter
44+ - name : unreachable-code
45+ - name : redefines-builtin-id
1546 maligned :
1647 suggest-new : true
1748 depguard :
@@ -54,20 +85,19 @@ linters:
5485 - gocritic
5586 - gofmt
5687 - goimports
57- - golint
88+ - revive
5889 - gomnd
5990 - goprintffuncname
6091 - gosec
6192 - gosimple
6293 - govet
6394 - ineffassign
64- - interfacer
6595 - lll
6696 - misspell
6797 - nakedret
6898 - nolintlint
6999 - rowserrcheck
70- - scopelint
100+ - exportloopref
71101 - staticcheck
72102 - structcheck
73103 - stylecheck
Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ GITTAG=$(shell git describe --always --tags)
1111VERSION=$(GITTAG:v% =%)
1212LINKER_FLAGS =-s -w -X 'github.com/mongodb/terraform-provider-mongodbatlas/version.ProviderVersion=${VERSION}'
1313
14- GOLANGCI_VERSION =v1.29.0
14+ GOLANGCI_VERSION =v1.41.1
1515
16- export PATH := ./bin:$(PATH )
16+ export PATH := $(shell go env GOPATH) /bin:$(PATH )
17+ export SHELL := env PATH=$(PATH ) /bin/bash
1718
1819default : build
1920
@@ -42,12 +43,12 @@ websitefmtcheck:
4243lint :
4344 @echo " ==> Checking source code against linters..."
4445 # https://github.com/golangci/golangci-lint/issues/337 fixing error
45- bin/ golangci-lint run ./$(PKG_NAME ) -v --deadline=30m
46+ golangci-lint run ./$(PKG_NAME ) -v --deadline=30m
4647
4748tools : # # Install dev tools
4849 @echo " ==> Installing dependencies..."
4950 GO111MODULE=on go install github.com/client9/misspell/cmd/misspell
50- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s $(GOLANGCI_VERSION )
51+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $( shell go env GOPATH) /bin $(GOLANGCI_VERSION )
5152
5253check : test lint
5354
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ package mongodbatlas
33import (
44 "context"
55 "fmt"
6+ "math/big"
67 "os"
78 "testing"
89
9- "math/rand"
10- "time"
10+ "crypto/rand"
1111
1212 "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
1313 "github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
@@ -89,10 +89,6 @@ const (
8989 alphaNum = alphabet + numeric
9090)
9191
92- var (
93- seeder = rand .New (rand .NewSource (time .Now ().UnixNano ()))
94- )
95-
9692type thirdPartyConfig struct {
9793 Name string
9894 ProjectID string
@@ -242,8 +238,10 @@ func testAccCreateThirdPartyIntegrationConfig() *matlas.ThirdPartyIntegration {
242238
243239func testGenString (length int , charSet string ) string {
244240 sequence := make ([]byte , length )
241+ upperBound := big .NewInt (int64 (len (charSet )))
245242 for i := range sequence {
246- sequence [i ] = charSet [seeder .Intn (len (charSet ))]
243+ n , _ := rand .Int (rand .Reader , upperBound )
244+ sequence [i ] = charSet [int (n .Int64 ())]
247245 }
248246 return string (sequence )
249247}
You can’t perform that action at this time.
0 commit comments