@@ -3,7 +3,6 @@ package main
33import (
44 "encoding/json"
55 "flag"
6- "fmt"
76 "io"
87 "log"
98 "net"
@@ -115,10 +114,10 @@ func parseEndpoint(endpoint string) (*url.URL, error) {
115114 return nil , err
116115 }
117116 if ! (u .Scheme == "http" || u .Scheme == "https" ) {
118- return nil , errors .Newf ("Invalid scheme %s. Require http or https" , u .Scheme )
117+ return nil , errors .Newf ("invalid scheme %s: require http or https" , u .Scheme )
119118 }
120119 if u .Host == "" {
121- return nil , errors .Newf ("Empty host" )
120+ return nil , errors .Newf ("empty host" )
122121 }
123122 return u , nil
124123}
@@ -262,20 +261,20 @@ func readConfig() (*config, error) {
262261 }
263262 isValidUDS , err := isValidUnixSocket (path )
264263 if err != nil {
265- return nil , errors .Newf ("Invalid proxy configuration: %w" , err )
264+ return nil , errors .Newf ("invalid proxy configuration: %w" , err )
266265 }
267266 if ! isValidUDS {
268267 return nil , errors .Newf ("invalid proxy socket: %s" , path )
269268 }
270269 cfg .proxyPath = path
271270 } else {
272- return nil , errors .Newf ("Invalid proxy endpoint: %s" , proxyStr )
271+ return nil , errors .Newf ("invalid proxy endpoint: %s" , proxyStr )
273272 }
274273 } else {
275274 // no SRC_PROXY; check for the standard proxy env variables HTTP_PROXY, HTTPS_PROXY, and NO_PROXY
276275 if u , err := http .ProxyFromEnvironment (& http.Request {URL : cfg .endpointURL }); err != nil {
277276 // when there's an error, the value for the env variable is not a legit URL
278- return nil , fmt . Errorf ( "Invalid HTTP_PROXY or HTTPS_PROXY value: %w" , err )
277+ return nil , errors . Newf ( "invalid HTTP_PROXY or HTTPS_PROXY value: %w" , err )
279278 } else {
280279 cfg .proxyURL = u
281280 }
@@ -310,7 +309,7 @@ func isValidUnixSocket(path string) (bool, error) {
310309 if os .IsNotExist (err ) {
311310 return false , nil
312311 }
313- return false , errors .Newf ("Not a UNIX Domain Socket : %v: %w" , path , err )
312+ return false , errors .Newf ("not a UNIX domain socket : %v: %w" , path , err )
314313 }
315314 defer conn .Close ()
316315
0 commit comments