Skip to content

Commit e97ff62

Browse files
authored
Fix lint errors & update formatting (#1292)
Lint error on Go 1.18: ``` provider/generate_test.go:250:18: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (SA1019) qa/testing.go:458:17: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead. (SA1019) ```
1 parent 36c961d commit e97ff62

File tree

7 files changed

+26
-25
lines changed

7 files changed

+26
-25
lines changed

catalog/data_views_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ func TestViewsData(t *testing.T) {
1616
Tables: []TableInfo{
1717
{
1818
CatalogName: "a",
19-
SchemaName: "b",
20-
Name: "c",
21-
TableType: "MANAGED",
19+
SchemaName: "b",
20+
Name: "c",
21+
TableType: "MANAGED",
2222
},
2323
{
2424
CatalogName: "a",
25-
SchemaName: "b",
26-
Name: "d",
27-
TableType: "VIEW",
25+
SchemaName: "b",
26+
Name: "d",
27+
TableType: "VIEW",
2828
},
2929
},
3030
},

catalog/resource_grants.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,29 +157,29 @@ func (sm securableMapping) validate(d attributeGetter, pl PermissionsList) error
157157
var mapping = securableMapping{
158158
// add other securable mappings once needed
159159
"table": {
160-
"MODIFY": true,
161-
"SELECT": true,
160+
"MODIFY": true,
161+
"SELECT": true,
162162
},
163163
"view": {
164-
"SELECT": true,
164+
"SELECT": true,
165165
},
166166
"catalog": {
167-
"CREATE": true,
168-
"USAGE": true,
167+
"CREATE": true,
168+
"USAGE": true,
169169
},
170170
"schema": {
171-
"CREATE": true,
172-
"USAGE": true,
171+
"CREATE": true,
172+
"USAGE": true,
173173
},
174174
"storage_credential": {
175-
"CREATE_TABLE": true,
176-
"READ_FILES": true,
177-
"WRITE_FILES": true,
175+
"CREATE_TABLE": true,
176+
"READ_FILES": true,
177+
"WRITE_FILES": true,
178178
},
179179
"external_location": {
180-
"CREATE_TABLE": true,
181-
"READ_FILES": true,
182-
"WRITE_FILES": true,
180+
"CREATE_TABLE": true,
181+
"READ_FILES": true,
182+
"WRITE_FILES": true,
183183
},
184184
}
185185

common/resource_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestHTTP404TriggersResourceRemovalForReadAndDelete(t *testing.T) {
4545
}
4646
r := Resource{
4747
Create: nope,
48-
Read: nope,
48+
Read: nope,
4949
Update: nope,
5050
Delete: nope,
5151
Schema: map[string]*schema.Schema{
@@ -59,7 +59,7 @@ func TestHTTP404TriggersResourceRemovalForReadAndDelete(t *testing.T) {
5959
client := &DatabricksClient{}
6060
ctx := context.Background()
6161
d := r.TestResourceData()
62-
62+
6363
// Create propagates 404 error
6464
diags := r.CreateContext(ctx, d, client)
6565
assert.True(t, diags.HasError())

permissions/resource_permissions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func (a PermissionsAPI) Read(objectID string) (objectACL ObjectACL, err error) {
205205
err = a.client.Get(a.context, urlPathForObjectID(objectID), nil, &objectACL)
206206
apiErr, ok := err.(common.APIError)
207207
// https://github.com/databrickslabs/terraform-provider-databricks/issues/1227
208-
// platform propagates INVALID_STATE error for auto-purged clusters in
208+
// platform propagates INVALID_STATE error for auto-purged clusters in
209209
// the permissions api. this adds "a logical fix" also here, not to introduce
210210
// cross-package dependency on "clusters".
211211
if ok && strings.Contains(apiErr.Message, "Cannot access cluster") && apiErr.StatusCode == 400 {

permissions/resource_permissions_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ func TestResourcePermissionsCreate_PathIdRetriever_Error(t *testing.T) {
799799
qa.HTTPFailures[0],
800800
},
801801
Resource: ResourcePermissions(),
802-
Create: true,
802+
Create: true,
803803
HCL: `notebook_path = "/foo/bar"
804804
805805
access_control {
@@ -816,7 +816,7 @@ func TestResourcePermissionsCreate_ActualUpdate_Error(t *testing.T) {
816816
qa.HTTPFailures[0],
817817
},
818818
Resource: ResourcePermissions(),
819-
Create: true,
819+
Create: true,
820820
HCL: `cluster_id = "abc"
821821
822822
access_control {

staticcheck.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
checks = ["inherit", "-SA1019"]

storage/resource_mount.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func ResourceMount() *schema.Resource {
6666
r.DeleteContext = mountCallback(mountDelete).preProcess(r)
6767
r.Importer = nil
6868
r.Timeouts = &schema.ResourceTimeout{
69-
Default: schema.DefaultTimeout(20*time.Minute),
69+
Default: schema.DefaultTimeout(20 * time.Minute),
7070
}
7171
return r
7272
}

0 commit comments

Comments
 (0)