Skip to content

Commit 846161d

Browse files
Saracomethsteinglours
authored andcommitted
Fix linting issue with resp.Body.Close()
Signed-off-by: Adel Sevastianov <102406080+Saracomethstein@users.noreply.github.com>
1 parent 0bcc629 commit 846161d

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

internal/desktop/client.go

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ func (c *Client) Ping(ctx context.Context) (*PingResponse, error) {
8484
if err != nil {
8585
return nil, err
8686
}
87-
defer resp.Body.Close()
87+
defer func() {
88+
_ = resp.Body.Close()
89+
}()
8890

8991
if resp.StatusCode != http.StatusOK {
9092
return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode)
@@ -113,7 +115,9 @@ func (c *Client) FeatureFlags(ctx context.Context) (FeatureFlagResponse, error)
113115
if err != nil {
114116
return nil, err
115117
}
116-
defer resp.Body.Close()
118+
defer func() {
119+
_ = resp.Body.Close()
120+
}()
117121

118122
if resp.StatusCode != http.StatusOK {
119123
return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode)
@@ -143,7 +147,9 @@ func (c *Client) GetFileSharesConfig(ctx context.Context) (*GetFileSharesConfigR
143147
if err != nil {
144148
return nil, err
145149
}
146-
defer resp.Body.Close()
150+
defer func() {
151+
_ = resp.Body.Close()
152+
}()
147153

148154
if resp.StatusCode != http.StatusOK {
149155
return nil, newHTTPStatusCodeError(resp)
@@ -181,7 +187,9 @@ func (c *Client) CreateFileShare(ctx context.Context, r CreateFileShareRequest)
181187
if err != nil {
182188
return nil, err
183189
}
184-
defer resp.Body.Close()
190+
defer func() {
191+
_ = resp.Body.Close()
192+
}()
185193

186194
if resp.StatusCode != http.StatusOK {
187195
errBody, _ := io.ReadAll(resp.Body)
@@ -223,7 +231,9 @@ func (c *Client) ListFileShares(ctx context.Context) ([]FileShareSession, error)
223231
if err != nil {
224232
return nil, err
225233
}
226-
defer resp.Body.Close()
234+
defer func() {
235+
_ = resp.Body.Close()
236+
}()
227237

228238
if resp.StatusCode != http.StatusOK {
229239
return nil, newHTTPStatusCodeError(resp)
@@ -246,7 +256,9 @@ func (c *Client) DeleteFileShare(ctx context.Context, id string) error {
246256
if err != nil {
247257
return err
248258
}
249-
defer resp.Body.Close()
259+
defer func() {
260+
_ = resp.Body.Close()
261+
}()
250262

251263
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
252264
return newHTTPStatusCodeError(resp)

0 commit comments

Comments
 (0)