fix: fix lintings #58

Merged
marcel.henselin merged 7 commits from chore/more_tests into alpha 2026-02-13 14:27:15 +00:00
12 changed files with 42 additions and 42 deletions
Showing only changes of commit 20593da30b - Show all commits

View file

@ -77,13 +77,13 @@ linters:
linters: linters:
- gochecknoinits - gochecknoinits
paths: paths:
- third_party$ - third_party/
- builtin$ - builtin/
- examples$ - examples/
- tools/copy.go - tools/copy.go
- tools/main.go - tools/main.go
- pkg_gen$ - pkg_gen/
- cmd$ - cmd/
formatters: formatters:
enable: enable:
- gofmt - gofmt
@ -95,8 +95,8 @@ formatters:
exclusions: exclusions:
generated: lax generated: lax
paths: paths:
- third_party$ - third_party/
- builtin$ - builtin/
- examples$ - examples/
- pkg_gen$ - pkg_gen/
- cmd$ - cmd/

View file

@ -88,7 +88,7 @@ func CleanupTemporaryHome(tempHomePath string, t *testing.T) {
} }
func ucFirst(s string) string { func ucFirst(s string) string {
if len(s) == 0 { if s == "" {
return "" return ""
} }
return strings.ToUpper(s[:1]) + s[1:] return strings.ToUpper(s[:1]) + s[1:]

View file

@ -390,7 +390,7 @@ func (r *databaseResource) Update(
core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (databaseId)") core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (databaseId)")
return return
} }
databaseId := int32(databaseId64) databaseId := int32(databaseId64) // nolint:gosec // check is performed above
ctx = tflog.SetField(ctx, "project_id", projectId) ctx = tflog.SetField(ctx, "project_id", projectId)
ctx = tflog.SetField(ctx, "instance_id", instanceId) ctx = tflog.SetField(ctx, "instance_id", instanceId)
@ -516,7 +516,7 @@ func (r *databaseResource) Delete(
core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (databaseId)") core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (databaseId)")
return return
} }
databaseId := int32(databaseId64) databaseId := int32(databaseId64) // nolint:gosec // check is performed above
ctx = tflog.SetField(ctx, "project_id", projectId) ctx = tflog.SetField(ctx, "project_id", projectId)
ctx = tflog.SetField(ctx, "instance_id", instanceId) ctx = tflog.SetField(ctx, "instance_id", instanceId)
ctx = tflog.SetField(ctx, "region", region) ctx = tflog.SetField(ctx, "region", region)

View file

@ -108,7 +108,7 @@ func (r *userDataSource) Read(
core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (userId)") core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (userId)")
return return
} }
userId := int32(userId64) userId := int32(userId64) // nolint:gosec // check is performed above
region := r.providerData.GetRegionWithOverride(model.Region) region := r.providerData.GetRegionWithOverride(model.Region)
ctx = tflog.SetField(ctx, "project_id", projectId) ctx = tflog.SetField(ctx, "project_id", projectId)

View file

@ -406,7 +406,7 @@ func (r *userResource) Update(
core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (userId)") core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (userId)")
return return
} }
userId := int32(userId64) userId := int32(userId64) // nolint:gosec // check is performed above
// Update existing instance // Update existing instance
err = r.client.UpdateUserRequest( err = r.client.UpdateUserRequest(
@ -518,7 +518,7 @@ func (r *userResource) Delete(
core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (userId)") core.LogAndAddError(ctx, &resp.Diagnostics, "Error in type conversion", "int value too large (userId)")
return return
} }
userId := int32(userId64) userId := int32(userId64) // nolint:gosec // check is performed above
// Delete existing record set // Delete existing record set
err := r.client.DeleteUserRequest(ctx, arg.projectId, arg.region, arg.instanceId, userId).Execute() err := r.client.DeleteUserRequest(ctx, arg.projectId, arg.region, arg.instanceId, userId).Execute()

View file

@ -191,7 +191,7 @@ func toUpdatePayload(
if m.Replicas.ValueInt64() > math.MaxUint32 { if m.Replicas.ValueInt64() > math.MaxUint32 {
return nil, fmt.Errorf("replicas value is too big for uint32") return nil, fmt.Errorf("replicas value is too big for uint32")
} }
replVal := sqlserverflex.Replicas(uint32(m.Replicas.ValueInt64())) replVal := sqlserverflex.Replicas(uint32(m.Replicas.ValueInt64())) // nolint:gosec // check is performed above
var netAcl []string var netAcl []string
diags := m.Network.Acl.ElementsAs(ctx, &netAcl, false) diags := m.Network.Acl.ElementsAs(ctx, &netAcl, false)

View file

@ -263,7 +263,7 @@ func toUpdatePayload(
if m.Replicas.ValueInt64() > math.MaxUint32 { if m.Replicas.ValueInt64() > math.MaxUint32 {
return nil, fmt.Errorf("replicas value is too big for uint32") return nil, fmt.Errorf("replicas value is too big for uint32")
} }
replVal := sqlserverflexbeta.Replicas(uint32(m.Replicas.ValueInt64())) replVal := sqlserverflexbeta.Replicas(uint32(m.Replicas.ValueInt64())) // nolint:gosec // check is performed above
var netAcl []string var netAcl []string
diags := m.Network.Acl.ElementsAs(ctx, &netAcl, false) diags := m.Network.Acl.ElementsAs(ctx, &netAcl, false)