|
4 | 4 | "context" |
5 | 5 | "encoding/json" |
6 | 6 | "flag" |
7 | | - "fmt" |
8 | 7 | "io" |
9 | 8 | "log" |
10 | 9 | "net" |
@@ -117,10 +116,10 @@ func parseEndpoint(endpoint string) (*url.URL, error) { |
117 | 116 | return nil, err |
118 | 117 | } |
119 | 118 | if !(u.Scheme == "http" || u.Scheme == "https") { |
120 | | - return nil, errors.Newf("Invalid scheme %s. Require http or https", u.Scheme) |
| 119 | + return nil, errors.Newf("invalid scheme %s: require http or https", u.Scheme) |
121 | 120 | } |
122 | 121 | if u.Host == "" { |
123 | | - return nil, errors.Newf("Empty host") |
| 122 | + return nil, errors.Newf("empty host") |
124 | 123 | } |
125 | 124 | return u, nil |
126 | 125 | } |
@@ -273,20 +272,20 @@ func readConfig() (*config, error) { |
273 | 272 | } |
274 | 273 | isValidUDS, err := isValidUnixSocket(path) |
275 | 274 | if err != nil { |
276 | | - return nil, errors.Newf("Invalid proxy configuration: %w", err) |
| 275 | + return nil, errors.Newf("invalid proxy configuration: %w", err) |
277 | 276 | } |
278 | 277 | if !isValidUDS { |
279 | 278 | return nil, errors.Newf("invalid proxy socket: %s", path) |
280 | 279 | } |
281 | 280 | cfg.proxyPath = path |
282 | 281 | } else { |
283 | | - return nil, errors.Newf("Invalid proxy endpoint: %s", proxyStr) |
| 282 | + return nil, errors.Newf("invalid proxy endpoint: %s", proxyStr) |
284 | 283 | } |
285 | 284 | } else { |
286 | 285 | // no SRC_PROXY; check for the standard proxy env variables HTTP_PROXY, HTTPS_PROXY, and NO_PROXY |
287 | 286 | if u, err := http.ProxyFromEnvironment(&http.Request{URL: cfg.endpointURL}); err != nil { |
288 | 287 | // when there's an error, the value for the env variable is not a legit URL |
289 | | - return nil, fmt.Errorf("Invalid HTTP_PROXY or HTTPS_PROXY value: %w", err) |
| 288 | + return nil, errors.Newf("invalid HTTP_PROXY or HTTPS_PROXY value: %w", err) |
290 | 289 | } else { |
291 | 290 | cfg.proxyURL = u |
292 | 291 | } |
@@ -321,7 +320,7 @@ func isValidUnixSocket(path string) (bool, error) { |
321 | 320 | if os.IsNotExist(err) { |
322 | 321 | return false, nil |
323 | 322 | } |
324 | | - return false, errors.Newf("Not a UNIX Domain Socket: %v: %w", path, err) |
| 323 | + return false, errors.Newf("not a UNIX domain socket: %v: %w", path, err) |
325 | 324 | } |
326 | 325 | defer conn.Close() |
327 | 326 |
|
|
0 commit comments