diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2020-06-11 14:40:38 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2020-06-15 07:05:56 -0400 |
commit | 200cfa41a434b7143620c2c252b3eb7ab3ef92f9 (patch) | |
tree | ccf0cb95297dc65d4dc8bd366963e2b037fb1a8b /pkg/bindings/connection.go | |
parent | 3f026eb6a682a68e69f9376b72157a8f084e575c (diff) | |
download | podman-200cfa41a434b7143620c2c252b3eb7ab3ef92f9.tar.gz podman-200cfa41a434b7143620c2c252b3eb7ab3ef92f9.tar.bz2 podman-200cfa41a434b7143620c2c252b3eb7ab3ef92f9.zip |
Turn on More linters
- misspell
- prealloc
- unparam
- nakedret
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'pkg/bindings/connection.go')
-rw-r--r-- | pkg/bindings/connection.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/pkg/bindings/connection.go b/pkg/bindings/connection.go index aa7f3707c..a9c61e5ae 100644 --- a/pkg/bindings/connection.go +++ b/pkg/bindings/connection.go @@ -115,12 +115,12 @@ func NewConnectionWithIdentity(ctx context.Context, uri string, passPhrase strin _url.Path = JoinURL(_url.Host, _url.Path) _url.Host = "" } - connection, err = unixClient(_url) + connection = unixClient(_url) case "tcp": if !strings.HasPrefix(uri, "tcp://") { return nil, errors.New("tcp URIs should begin with tcp://") } - connection, err = tcpClient(_url) + connection = tcpClient(_url) default: return nil, errors.Errorf("'%s' is not a supported schema", _url.Scheme) } @@ -135,7 +135,7 @@ func NewConnectionWithIdentity(ctx context.Context, uri string, passPhrase strin return ctx, nil } -func tcpClient(_url *url.URL) (Connection, error) { +func tcpClient(_url *url.URL) Connection { connection := Connection{ URI: _url, } @@ -147,7 +147,7 @@ func tcpClient(_url *url.URL) (Connection, error) { DisableCompression: true, }, } - return connection, nil + return connection } // pingNewConnection pings to make sure the RESTFUL service is up @@ -186,8 +186,7 @@ func pingNewConnection(ctx context.Context) error { } func sshClient(_url *url.URL, secure bool, passPhrase string, identities ...string) (Connection, error) { - var authMethods []ssh.AuthMethod - + authMethods := []ssh.AuthMethod{} for _, i := range identities { auth, err := publicKey(i, []byte(passPhrase)) if err != nil { @@ -256,7 +255,7 @@ func sshClient(_url *url.URL, secure bool, passPhrase string, identities ...stri return connection, nil } -func unixClient(_url *url.URL) (Connection, error) { +func unixClient(_url *url.URL) Connection { connection := Connection{URI: _url} connection.Client = &http.Client{ Transport: &http.Transport{ @@ -266,7 +265,7 @@ func unixClient(_url *url.URL) (Connection, error) { DisableCompression: true, }, } - return connection, nil + return connection } // DoRequest assembles the http request and returns the response |