fix: linting (#77)

## Description

<!-- **Please link some issue here describing what you are trying to achieve.**

In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->

relates to #1234

## Checklist

- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)

Reviewed-on: #77
Co-authored-by: Andre Harms <andre.harms@stackit.cloud>
Co-committed-by: Andre Harms <andre.harms@stackit.cloud>
This commit is contained in:
Andre_Harms 2026-02-19 08:54:34 +00:00 committed by Marcel_Henselin
parent 36eccc52c3
commit 4a2819787d
Signed by: tf-provider.git.onstackit.cloud
GPG key ID: 6D7E8A1ED8955A9C
74 changed files with 3010 additions and 2432 deletions

View file

@ -108,7 +108,7 @@ func CreateInstanceWaitHandler(
)
if extendedTimeout < 3 {
maxWait += time.Minute * 5
extendedTimeout = extendedTimeout + 1
extendedTimeout++
if *s.Network.AccessScope == "SNA" {
ready := true
if s.Network == nil || s.Network.InstanceAddress == nil {
@ -228,7 +228,7 @@ func GetUserByIdWaitHandler(
if userId > math.MaxInt32 {
return false, nil, fmt.Errorf("userId value is too big for int32")
}
userId32 := int32(userId)
userId32 := int32(userId) //nolint:gosec // we need to convert databaseId to int32 because API expects int32
s, err := a.GetUserRequestExecute(ctx, projectId, region, instanceId, userId32)
if err != nil {
var oapiErr *oapierror.GenericOpenAPIError
@ -239,9 +239,11 @@ func GetUserByIdWaitHandler(
switch oapiErr.StatusCode {
case http.StatusBadGateway, http.StatusGatewayTimeout, http.StatusServiceUnavailable:
case http.StatusNotFound:
tflog.Warn(ctx, "api responded with status", map[string]interface{}{
"status": oapiErr.StatusCode,
})
tflog.Warn(
ctx, "api responded with status", map[string]interface{}{
"status": oapiErr.StatusCode,
},
)
return false, nil, nil
default:
return false, nil, err
@ -262,7 +264,7 @@ func GetDatabaseByIdWaitHandler(
) *wait.AsyncActionHandler[postgresflex.GetDatabaseResponse] {
handler := wait.New(
func() (waitFinished bool, response *postgresflex.GetDatabaseResponse, err error) {
dbId32 := int32(databaseId)
dbId32 := int32(databaseId) //nolint:gosec // we need to convert databaseId to int32 because API expects int32
s, err := a.GetDatabaseRequestExecute(ctx, projectId, region, instanceId, dbId32)
if err != nil {
var oapiErr *oapierror.GenericOpenAPIError
@ -272,14 +274,18 @@ func GetDatabaseByIdWaitHandler(
}
switch oapiErr.StatusCode {
case http.StatusBadGateway, http.StatusGatewayTimeout, http.StatusServiceUnavailable:
tflog.Warn(ctx, "api responded with 50[2,3,4] status", map[string]interface{}{
"status": oapiErr.StatusCode,
})
tflog.Warn(
ctx, "api responded with 50[2,3,4] status", map[string]interface{}{
"status": oapiErr.StatusCode,
},
)
return false, nil, nil
case http.StatusNotFound:
tflog.Warn(ctx, "api responded with 404 status", map[string]interface{}{
"status": oapiErr.StatusCode,
})
tflog.Warn(
ctx, "api responded with 404 status", map[string]interface{}{
"status": oapiErr.StatusCode,
},
)
return false, nil, nil
default:
return false, nil, err