Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Paweł Szulik <paul.szulik@gmail.com>
  • Loading branch information
Creatone committed Jun 27, 2023
1 parent e22a62e commit b161cad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
12 changes: 6 additions & 6 deletions container/podman/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"fmt"
"net"
"net/http"
"net/url"
urllib "net/url"
)

type clientKey struct{}
Expand All @@ -29,23 +29,23 @@ func (c clientKey) String() string {
}

type Connection struct {
URI *url.URL
URI *urllib.URL
Client *http.Client
}

func client(ctx *context.Context) (*Connection, error) {
_url, err := url.Parse(*endpointFlag)
url, err := urllib.Parse(*endpointFlag)
if err != nil {
return nil, err
}

switch _url.Scheme {
switch url.Scheme {
case "unix":
connection := Connection{URI: _url}
connection := Connection{URI: url}
connection.Client = &http.Client{
Transport: &http.Transport{
DialContext: func(ctx context.Context, _, _ string) (net.Conn, error) {
return (&net.Dialer{}).DialContext(ctx, "unix", _url.Path)
return (&net.Dialer{}).DialContext(ctx, "unix", url.Path)
},
DisableCompression: true,
},
Expand Down
4 changes: 0 additions & 4 deletions container/podman/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ func validateResponse(gotError error, response *http.Response) error {
err = fmt.Errorf("item not found")
case response.StatusCode == http.StatusNotImplemented:
err = fmt.Errorf("query not implemented")
case response.StatusCode != http.StatusOK:
err = fmt.Errorf("status not ok")
case gotError == nil:
return nil
default:
return gotError
}
Expand Down

0 comments on commit b161cad

Please sign in to comment.