Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.1'
go-version-file: 'go.mod'

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v8
with:
version: latest
skip-cache: true
args: --timeout 5m --verbose
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/hostinger/terraform-provider-hostinger

go 1.24.2
go 1.25.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

go version
go env GOTOOLCHAIN

rg -n --hidden -g '!.git' \
  -e '1\.24(\.[0-9]+)?' \
  -e 'setup-go|go-version|golang:' \
  -e 'darwin|macos|GOOS|GOARCH' .

Repository: hostinger/terraform-provider-hostinger

Length of output: 873


🏁 Script executed:

cat -n go.mod | head -50

Repository: hostinger/terraform-provider-hostinger

Length of output: 2674


🌐 Web query:

Go 1.25 macOS minimum version requirement

💡 Result:

Go 1.25 requires macOS 12 (Monterey) or later [1][2]. Support for macOS 11 and earlier versions was discontinued beginning with the Go 1.25 release [1][3]. Users requiring support for macOS 11 must continue using the Go 1.24 release series [4][3].

Citations:


🏁 Script executed:

python3 - <<'PY'
# Check the golang.org/x modules mentioned in lines 37-42
modules = [
    ("golang.org/x/mod", "v0.35.0"),
    ("golang.org/x/net", "v0.55.0"),
    ("golang.org/x/sync", "v0.20.0"),
    ("golang.org/x/sys", "v0.45.0"),
    ("golang.org/x/text", "v0.37.0"),
    ("golang.org/x/tools", "v0.44.0"),
]

print("golang.org/x module versions in go.mod:")
for mod, version in modules:
    print(f"  {mod} {version}")
PY

Repository: hostinger/terraform-provider-hostinger

Length of output: 382


🌐 Web query:

golang.org/x/mod v0.35.0 golang.org/x/net v0.55.0 minimum Go version requirements compatibility

💡 Result:

For the specified versions of the Go supplementary modules, the minimum Go version requirements are as follows: - golang.org/x/mod v0.35.0 requires Go 1.25.0 [1]. - golang.org/x/net v0.55.0 requires Go 1.25.0 [2]. In the Go module system, the go directive in the go.mod file declares the minimum version of the Go toolchain required to compile the module [3][4]. If your project depends on these modules, your own module's go.mod file must specify a Go version that is greater than or equal to the requirement of your dependencies [3][4]. If your environment uses a Go version older than what is specified in a dependency's go.mod file, the Go toolchain will refuse to use that module [3][4]. You can verify the minimum Go version requirement for any specific package version by checking its documentation on pkg.go.dev [1][2] or by inspecting the go directive directly in the repository's go.mod file [5].

Citations:


🏁 Script executed:

fd -type f \( -name "Dockerfile*" -o -name "*.dockerfile" -o -name ".python-version" -o -name ".nvmrc" \) -o -path "*docker*" -type f

Repository: hostinger/terraform-provider-hostinger

Length of output: 347


🏁 Script executed:

rg -n "golang:|FROM.*go|go.*1\.[0-9]+\.[0-9]+" --type dockerfile --type yaml --type json .

Repository: hostinger/terraform-provider-hostinger

Length of output: 211


🏁 Script executed:

find . -type f \( -name "Dockerfile*" -o -name "*.yml" -o -name "*.yaml" \) | head -20

Repository: hostinger/terraform-provider-hostinger

Length of output: 277


🏁 Script executed:

rg -n "golang:|FROM.*go|go.*1\.[0-9]+" --type yaml .

Repository: hostinger/terraform-provider-hostinger

Length of output: 176


🏁 Script executed:

cat -n .goreleaser.yml

Repository: hostinger/terraform-provider-hostinger

Length of output: 2411


🏁 Script executed:

cat -n .github/workflows/release.yml

Repository: hostinger/terraform-provider-hostinger

Length of output: 1877


🏁 Script executed:

cat -n .github/workflows/lint.yml

Repository: hostinger/terraform-provider-hostinger

Length of output: 830


🏁 Script executed:

fd -type f -name "README*" | head -5

Repository: hostinger/terraform-provider-hostinger

Length of output: 347


🏁 Script executed:

rg -i "macos|darwin|minimum|supported|version" README* -A 2 -B 2 2>/dev/null | head -50

Repository: hostinger/terraform-provider-hostinger

Length of output: 266


Verify Go version requirements are documented as macOS 12 minimum.

This upgrade is necessary—the updated golang.org/x/* dependencies (mod v0.35.0, net v0.55.0, etc.) require Go 1.25.0 (pkg.go.dev). Go 1.25 requires macOS 12 or later; if your documentation or supported platform matrix lists macOS 11, update it. CI workflows are already configured to follow go.mod automatically via go-version-file, so no CI changes are needed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@go.mod` at line 3, Update the documentation or supported-platform matrix to
state macOS 12 as the minimum supported version, replacing any macOS 11
references. Do not modify CI workflows, which already derive the Go version from
go.mod.


require github.com/hashicorp/terraform-plugin-sdk/v2 v2.36.1

Expand Down Expand Up @@ -34,12 +34,12 @@ require (
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zclconf/go-cty v1.16.2 // indirect
golang.org/x/mod v0.30.0 // indirect
golang.org/x/net v0.48.0 // indirect
golang.org/x/sync v0.19.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/text v0.32.0 // indirect
golang.org/x/tools v0.39.0 // indirect
golang.org/x/mod v0.35.0 // indirect
golang.org/x/net v0.55.0 // indirect
golang.org/x/sync v0.20.0 // indirect
golang.org/x/sys v0.45.0 // indirect
golang.org/x/text v0.37.0 // indirect
golang.org/x/tools v0.44.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
google.golang.org/grpc v1.79.3 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,19 @@ go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4Etq
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.30.0 h1:fDEXFVZ/fmCKProc/yAXXUijritrDzahmwwefnjoPFk=
golang.org/x/mod v0.30.0/go.mod h1:lAsf5O2EvJeSFMiBxXDki7sCgAxEUcZHXoXMKT4GJKc=
golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM=
golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
golang.org/x/net v0.55.0 h1:bcvxaJn3e1U6InsFWt1JUq1aSjnRxLzT2rtD2KfkDF8=
golang.org/x/net v0.55.0/go.mod h1:L5U2KuzuOe1lY7Z+aWVIKK6qEeJXnXV9yzGA+WCHJww=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand All @@ -142,22 +142,22 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc=
golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.39.0 h1:ik4ho21kwuQln40uelmciQPp9SipgNDdrafrYA4TmQQ=
golang.org/x/tools v0.39.0/go.mod h1:JnefbkDPyD8UU2kI5fuf8ZX4/yUeh9W877ZeBONxUqQ=
golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=
golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
Expand Down
20 changes: 10 additions & 10 deletions hostinger/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (c *HostingerClient) GetDefaultPaymentMethod() (int, error) {
if err != nil {
return 0, err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand Down Expand Up @@ -97,7 +97,7 @@ func (c *HostingerClient) GetSubscriptionDetails(subscriptionID string) (*Subscr
if err != nil {
return nil, err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode == http.StatusNotFound {
return nil, ErrNotFound
Expand Down Expand Up @@ -148,7 +148,7 @@ func (c *HostingerClient) CancelSubscription(subscriptionID string) error {
if err != nil {
return fmt.Errorf("API request failed: %w", err)
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusNoContent && resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand Down Expand Up @@ -204,7 +204,7 @@ func (c *HostingerClient) PurchaseVPS(req PurchaseVPSRequest) (*PurchaseVPSRespo
if err != nil {
return nil, fmt.Errorf("API request failed: %w", err)
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
errMsg, _ := io.ReadAll(resp.Body)
Expand Down Expand Up @@ -257,7 +257,7 @@ func (c *HostingerClient) GetVirtualMachines() ([]VirtualMachine, error) {
if err != nil {
return nil, err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("failed to list VPS instances (HTTP %d)", resp.StatusCode)
Expand Down Expand Up @@ -324,7 +324,7 @@ func (c *HostingerClient) SetupVirtualMachine(vmID int, setup SetupRequest) (*Vi
if err != nil {
return nil, err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
errMsg, _ := io.ReadAll(resp.Body)
Expand All @@ -351,7 +351,7 @@ func (c *HostingerClient) GetVirtualMachine(vmID int) (*VirtualMachine, error) {
if err != nil {
return nil, err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode == http.StatusNotFound {
return nil, ErrNotFound
Expand Down Expand Up @@ -435,7 +435,7 @@ func (c *HostingerClient) UpdateHostname(vmID int, hostname string) error {
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand Down Expand Up @@ -473,7 +473,7 @@ func (c *HostingerClient) RecreateVirtualMachine(vmID int, templateID int, passw
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand All @@ -493,7 +493,7 @@ func (c *HostingerClient) GetSSHKeyIDsForVM(vmID int) ([]int, error) {
if err != nil {
return nil, err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand Down
12 changes: 6 additions & 6 deletions hostinger/dns_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func resourceHostingerDNSRecordCreate(d *schema.ResourceData, meta interface{})
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

respBody, _ := io.ReadAll(resp.Body)
if resp.StatusCode != http.StatusOK {
Expand Down Expand Up @@ -175,7 +175,7 @@ func resourceHostingerDNSRecordRead(d *schema.ResourceData, meta interface{}) er
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

body, _ := io.ReadAll(resp.Body)
if resp.StatusCode != http.StatusOK {
Expand Down Expand Up @@ -263,7 +263,7 @@ func resourceHostingerDNSRecordDelete(d *schema.ResourceData, meta interface{})
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

body, _ := io.ReadAll(resp.Body)
if resp.StatusCode != http.StatusOK {
Expand Down Expand Up @@ -363,7 +363,7 @@ func resourceHostingerDNSRecordDelete(d *schema.ResourceData, meta interface{})
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusAccepted {
respBody, _ := io.ReadAll(resp.Body)
Expand Down Expand Up @@ -395,7 +395,7 @@ func resourceHostingerDNSRecordDelete(d *schema.ResourceData, meta interface{})
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
respBody, _ := io.ReadAll(resp.Body)
Expand Down Expand Up @@ -432,7 +432,7 @@ func resourceHostingerDNSRecordDelete(d *schema.ResourceData, meta interface{})
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

respBody, _ := io.ReadAll(resp.Body)
if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusAccepted {
Expand Down
6 changes: 3 additions & 3 deletions hostinger/vps_data_sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func dataSourceHostingerVPSTemplatesRead(ctx context.Context, d *schema.Resource
if err != nil {
return diag.FromErr(err)
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
return diag.Errorf("failed to fetch templates: %s", resp.Status)
Expand Down Expand Up @@ -116,7 +116,7 @@ func dataSourceHostingerVPSDataCentersRead(ctx context.Context, d *schema.Resour
if err != nil {
return diag.FromErr(err)
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

var result []map[string]interface{}
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
Expand Down Expand Up @@ -160,7 +160,7 @@ func dataSourceHostingerVPSPlansRead(ctx context.Context, d *schema.ResourceData
if err != nil {
return diag.FromErr(err)
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

var raw []map[string]interface{}
if err := json.NewDecoder(resp.Body).Decode(&raw); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions hostinger/vps_data_sources_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (c *HostingerClient) ValidatePlanID(plan string) (bool, error) {
if err != nil {
return false, err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand Down Expand Up @@ -53,7 +53,7 @@ func (c *HostingerClient) ValidateTemplateID(id int) (bool, error) {
if err != nil {
return false, err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand Down Expand Up @@ -85,7 +85,7 @@ func (c *HostingerClient) ValidateDataCenterID(id int) (bool, error) {
if err != nil {
return false, err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand Down
8 changes: 4 additions & 4 deletions hostinger/vps_post_install_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (c *HostingerClient) CreatePostInstallScript(name, content string) (int, er
if err != nil {
return 0, err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand All @@ -139,7 +139,7 @@ func (c *HostingerClient) GetPostInstallScript(id int) (*PostInstallScript, erro
if err != nil {
return nil, err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand All @@ -165,7 +165,7 @@ func (c *HostingerClient) UpdatePostInstallScript(id int, name, content string)
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand All @@ -183,7 +183,7 @@ func (c *HostingerClient) DeletePostInstallScript(id int) error {
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand Down
8 changes: 4 additions & 4 deletions hostinger/vps_ssh_key_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func resourceHostingerVPSSSHKeyCreate(ctx context.Context, d *schema.ResourceDat
if err != nil {
return diag.FromErr(err)
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand All @@ -91,7 +91,7 @@ func resourceHostingerVPSSSHKeyRead(ctx context.Context, d *schema.ResourceData,
if err != nil {
return diag.FromErr(err)
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand Down Expand Up @@ -133,7 +133,7 @@ func resourceHostingerVPSSSHKeyDelete(ctx context.Context, d *schema.ResourceDat
if err != nil {
return diag.FromErr(err)
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand All @@ -158,7 +158,7 @@ func (c *HostingerClient) AttachSSHKeysToVM(vmID int, keyIDs []int) error {
if err != nil {
return err
}
defer resp.Body.Close()
defer func() { _ = resp.Body.Close() }()

if resp.StatusCode != http.StatusOK {
msg, _ := io.ReadAll(resp.Body)
Expand Down
Loading