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:
10
10
- octalLiteral
11
11
govet :
12
12
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
15
46
maligned :
16
47
suggest-new : true
17
48
depguard :
@@ -54,20 +85,19 @@ linters:
54
85
- gocritic
55
86
- gofmt
56
87
- goimports
57
- - golint
88
+ - revive
58
89
- gomnd
59
90
- goprintffuncname
60
91
- gosec
61
92
- gosimple
62
93
- govet
63
94
- ineffassign
64
- - interfacer
65
95
- lll
66
96
- misspell
67
97
- nakedret
68
98
- nolintlint
69
99
- rowserrcheck
70
- - scopelint
100
+ - exportloopref
71
101
- staticcheck
72
102
- structcheck
73
103
- stylecheck
Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ GITTAG=$(shell git describe --always --tags)
11
11
VERSION=$(GITTAG:v% =%)
12
12
LINKER_FLAGS =-s -w -X 'github.com/mongodb/terraform-provider-mongodbatlas/version.ProviderVersion=${VERSION}'
13
13
14
- GOLANGCI_VERSION =v1.29.0
14
+ GOLANGCI_VERSION =v1.41.1
15
15
16
- export PATH := ./bin:$(PATH )
16
+ export PATH := $(shell go env GOPATH) /bin:$(PATH )
17
+ export SHELL := env PATH=$(PATH ) /bin/bash
17
18
18
19
default : build
19
20
@@ -42,12 +43,12 @@ websitefmtcheck:
42
43
lint :
43
44
@echo " ==> Checking source code against linters..."
44
45
# 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
46
47
47
48
tools : # # Install dev tools
48
49
@echo " ==> Installing dependencies..."
49
50
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 )
51
52
52
53
check : test lint
53
54
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ package mongodbatlas
3
3
import (
4
4
"context"
5
5
"fmt"
6
+ "math/big"
6
7
"os"
7
8
"testing"
8
9
9
- "math/rand"
10
- "time"
10
+ "crypto/rand"
11
11
12
12
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
13
13
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
@@ -89,10 +89,6 @@ const (
89
89
alphaNum = alphabet + numeric
90
90
)
91
91
92
- var (
93
- seeder = rand .New (rand .NewSource (time .Now ().UnixNano ()))
94
- )
95
-
96
92
type thirdPartyConfig struct {
97
93
Name string
98
94
ProjectID string
@@ -242,8 +238,10 @@ func testAccCreateThirdPartyIntegrationConfig() *matlas.ThirdPartyIntegration {
242
238
243
239
func testGenString (length int , charSet string ) string {
244
240
sequence := make ([]byte , length )
241
+ upperBound := big .NewInt (int64 (len (charSet )))
245
242
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 ())]
247
245
}
248
246
return string (sequence )
249
247
}
You can’t perform that action at this time.
0 commit comments