Skip to content

Commit 00f94b2

Browse files
authored
Apply golangci-lint autofixes (#632)
1 parent 0fd9590 commit 00f94b2

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

client/client.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package client
22

33
import (
4+
"errors"
45
"fmt"
56
"net/http"
67
"time"
@@ -28,19 +29,19 @@ func GenericJSONErrorHandling(resp *resty.Response, err error) (*resty.Response,
2829
}
2930
case http.StatusInternalServerError:
3031
if !resty.IsJSONType(resp.Header().Get("Content-Type")) {
31-
return nil, fmt.Errorf("unknown error occurred, check supervisor logs with 'ha supervisor logs'")
32+
return nil, errors.New("unknown error occurred, check supervisor logs with 'ha supervisor logs'")
3233
}
3334
case http.StatusUnauthorized:
3435
if !resty.IsJSONType(resp.Header().Get("Content-Type")) {
35-
return nil, fmt.Errorf("unauthorized: missing or invalid API token")
36+
return nil, errors.New("unauthorized: missing or invalid API token")
3637
}
3738
case http.StatusForbidden:
3839
// Handle both JSON and plain text forbidden responses
3940
if !resty.IsJSONType(resp.Header().Get("Content-Type")) {
40-
return nil, fmt.Errorf("forbidden: insufficient permissions or invalid token")
41+
return nil, errors.New("forbidden: insufficient permissions or invalid token")
4142
}
4243
case http.StatusBadGateway:
43-
return nil, fmt.Errorf("bad gateway: core proxy or ingress service failure")
44+
return nil, errors.New("bad gateway: core proxy or ingress service failure")
4445
default:
4546
return nil, fmt.Errorf("unexpected server response (status: %d)", resp.StatusCode())
4647
}

cmd/docker_options.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cmd
22

33
import (
4+
"errors"
45
"fmt"
56
"strings"
67

@@ -45,7 +46,7 @@ docker backend running on your Home Assistant system.`,
4546
if mtu == 0 {
4647
options["mtu"] = nil
4748
} else if mtu < 68 || mtu > 65535 {
48-
helper.PrintError(fmt.Errorf("MTU value must be between 68 and 65535, or 0 to reset"))
49+
helper.PrintError(errors.New("MTU value must be between 68 and 65535, or 0 to reset"))
4950
ExitWithError = true
5051
return
5152
} else {

0 commit comments

Comments
 (0)