Skip to content

Commit 41eb942

Browse files
committed
chore: fix nilerr linter (scaleway#1284)
1 parent 616b895 commit 41eb942

6 files changed

+7
-7
lines changed

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ linters:
3535
- makezero # Finds slice declarations with non-zero initial length [fast: false, auto-fix: false]
3636
- misspell # Finds commonly misspelled English words in comments [fast: true, auto-fix: true]
3737
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true, auto-fix: false]
38+
- nilerr # Finds the code that returns nil even if it checks that the error is not nil. [fast: false, auto-fix: false]
3839
- noctx # noctx finds sending http request without context.Context [fast: false, auto-fix: false]
3940
- nolintlint # Reports ill-formed or insufficient nolint directives [fast: true, auto-fix: false]
4041
- nosprintfhostport # Checks for misuse of Sprintf to construct a host with port in a URL. [fast: true, auto-fix: false]
@@ -80,7 +81,6 @@ linters:
8081
- maintidx # maintidx measures the maintainability index of each function. [fast: true, auto-fix: false]
8182
- maligned #[deprecated]: Tool to detect Go structs that would take less memory if their fields were sorted [fast: false, auto-fix: false]
8283
- nestif # Reports deeply nested if statements [fast: true, auto-fix: false]
83-
- nilerr # Finds the code that returns nil even if it checks that the error is not nil. [fast: false, auto-fix: false]
8484
- nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value. [fast: false, auto-fix: false]
8585
- nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity [fast: true, auto-fix: false]
8686
- nonamedreturns # Reports all named returns [fast: true, auto-fix: false]

scaleway/data_source_registry_image_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func testAccCheckScalewayRegistryImageExists(tt *TestTools, n string) resource.T
6565

6666
api, region, id, err := registryAPIWithRegionAndID(tt.Meta, rs.Primary.ID)
6767
if err != nil {
68-
return nil
68+
return err
6969
}
7070

7171
_, err = api.GetImage(&registry.GetImageRequest{

scaleway/resource_container_namespace_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func testAccCheckScalewayContainerNamespaceExists(tt *TestTools, n string) resou
156156

157157
api, region, id, err := containerAPIWithRegionAndID(tt.Meta, rs.Primary.ID)
158158
if err != nil {
159-
return nil
159+
return err
160160
}
161161

162162
_, err = api.GetNamespace(&container.GetNamespaceRequest{

scaleway/resource_container_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ func testAccCheckScalewayContainerExists(tt *TestTools, n string) resource.TestC
187187

188188
api, region, id, err := containerAPIWithRegionAndID(tt.Meta, rs.Primary.ID)
189189
if err != nil {
190-
return nil
190+
return err
191191
}
192192

193193
_, err = api.GetContainer(&container.GetContainerRequest{
@@ -241,7 +241,7 @@ func testConfigContainerNamespace(tt *TestTools, n string) resource.TestCheckFun
241241
}
242242
api, region, id, err := containerAPIWithRegionAndID(tt.Meta, rs.Primary.ID)
243243
if err != nil {
244-
return nil
244+
return err
245245
}
246246

247247
ns, err := api.WaitForNamespace(&container.WaitForNamespaceRequest{

scaleway/resource_function_namespace_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func testAccCheckScalewayFunctionNamespaceExists(tt *TestTools, n string) resour
179179

180180
api, region, id, err := functionAPIWithRegionAndID(tt.Meta, rs.Primary.ID)
181181
if err != nil {
182-
return nil
182+
return err
183183
}
184184

185185
_, err = api.GetNamespace(&function.GetNamespaceRequest{

scaleway/resource_registry_namespace_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func testAccCheckScalewayRegistryNamespaceExists(tt *TestTools, n string) resour
9292

9393
api, region, id, err := registryAPIWithRegionAndID(tt.Meta, rs.Primary.ID)
9494
if err != nil {
95-
return nil
95+
return err
9696
}
9797

9898
_, err = api.GetNamespace(&registry.GetNamespaceRequest{

0 commit comments

Comments
 (0)