Skip to content

Commit 1db1c1e

Browse files
authored
Merge pull request #2749 from Prajyot-Parab/update
Introduce additional linters & bump golangci-lint to 1.50.0
2 parents aea26cf + 0b3502a commit 1db1c1e

File tree

25 files changed

+47
-39
lines changed

25 files changed

+47
-39
lines changed

.codespellignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ ot
55
intepreted
66
updat
77
shouldnot
8+
decorder

.golangci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,17 @@ run:
77
linters:
88
disable-all: true
99
enable:
10+
- asasalint
1011
- asciicheck
1112
- bodyclose
1213
- containedctx
14+
- decorder
1315
- depguard
1416
- dogsled
1517
- errcheck
18+
- errchkjson
1619
- errorlint
20+
- execinquery
1721
- exportloopref
1822
- gci
1923
- goconst
@@ -33,8 +37,10 @@ linters:
3337
- nilerr
3438
- noctx
3539
- nolintlint
40+
- nosprintfhostport
3641
- prealloc
3742
- predeclared
43+
- reassign
3844
- revive
3945
- rowserrcheck
4046
- staticcheck
@@ -44,6 +50,7 @@ linters:
4450
- unconvert
4551
- unparam
4652
- unused
53+
- usestdlibvars
4754
- whitespace
4855
# Run with --fast=false for more extensive checks
4956
fast: true

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ ENVSUBST_VER := v2.0.0-20210730161058-179042472c46
8181
ENVSUBST_BIN := envsubst
8282
ENVSUBST := $(TOOLS_BIN_DIR)/$(ENVSUBST_BIN)-$(ENVSUBST_VER)
8383

84-
GOLANGCI_LINT_VER := v1.49.0
84+
GOLANGCI_LINT_VER := v1.50.0
8585
GOLANGCI_LINT_BIN := golangci-lint
8686
GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER)
8787

azure/converters/futures_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
var (
2929
sdkFuture, _ = azureautorest.NewFutureFromResponse(&http.Response{
3030
Status: "200 OK",
31-
StatusCode: 200,
31+
StatusCode: http.StatusOK,
3232
Request: &http.Request{
3333
Method: http.MethodDelete,
3434
},

azure/defaults_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func TestMSCorrelationIDSendDecorator(t *testing.T) {
9292
// preserve the incoming headers to the fake server, so that
9393
// we can test that the fake server received the right
9494
// correlation ID header.
95-
req, err := http.NewRequest("GET", testSrv.URL, http.NoBody)
95+
req, err := http.NewRequest(http.MethodGet, testSrv.URL, http.NoBody)
9696
if err != nil {
9797
return nil, err
9898
}
@@ -103,7 +103,7 @@ func TestMSCorrelationIDSendDecorator(t *testing.T) {
103103
newSender := autorest.DecorateSender(origSender, msCorrelationIDSendDecorator)
104104

105105
// create a new HTTP request and send it via the new decorated sender
106-
req, err := http.NewRequest("GET", "/abc", http.NoBody)
106+
req, err := http.NewRequest(http.MethodGet, "/abc", http.NoBody)
107107
g.Expect(err).NotTo(HaveOccurred())
108108

109109
req = req.WithContext(ctx)

azure/services/agentpools/agentpools_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ var (
5656
Headers: map[string]string{"fake-header": "fake-value"},
5757
}
5858

59-
internalError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: 500}, "Internal Server Error")
59+
internalError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: http.StatusInternalServerError}, "Internal Server Error")
6060
)
6161

6262
func TestReconcileAgentPools(t *testing.T) {

azure/services/async/async_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ var (
5959
}
6060
fakeExistingResource = resources.GenericResource{}
6161
fakeResourceParameters = resources.GenericResource{}
62-
fakeInternalError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: 500}, "Internal Server Error")
63-
fakeNotFoundError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: 404}, "Not Found")
62+
fakeInternalError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: http.StatusInternalServerError}, "Internal Server Error")
63+
fakeNotFoundError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: http.StatusNotFound}, "Not Found")
6464
errCtxExceeded = errors.New("ctx exceeded")
6565
)
6666

azure/services/availabilitysets/availabilitysets_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ var (
6161
SKU: nil,
6262
AdditionalTags: map[string]string{},
6363
}
64-
internalError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: 500}, "Internal Server Error")
64+
internalError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: http.StatusInternalServerError}, "Internal Server Error")
6565
parameterError = errors.Errorf("some error with parameters")
66-
notFoundError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: 404}, "Not Found")
66+
notFoundError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: http.StatusNotFound}, "Not Found")
6767
fakeSetWithVMs = compute.AvailabilitySet{
6868
AvailabilitySetProperties: &compute.AvailabilitySetProperties{
6969
VirtualMachines: &[]compute.SubResource{

azure/services/bastionhosts/bastionhosts_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var (
4242
SubnetID: fakeSubnetID,
4343
PublicIPID: fakePublicIPID,
4444
}
45-
internalError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: 500}, "Internal Server Error")
45+
internalError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: http.StatusInternalServerError}, "Internal Server Error")
4646
)
4747

4848
func init() {

azure/services/disks/disks_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ var (
4747
&diskSpec2,
4848
}
4949

50-
internalError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: 500}, "Internal Server Error")
50+
internalError = autorest.NewErrorWithResponse("", "", &http.Response{StatusCode: http.StatusInternalServerError}, "Internal Server Error")
5151
)
5252

5353
func TestDeleteDisk(t *testing.T) {

0 commit comments

Comments
 (0)