From 200cfa41a434b7143620c2c252b3eb7ab3ef92f9 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 11 Jun 2020 14:40:38 -0400 Subject: Turn on More linters - misspell - prealloc - unparam - nakedret Signed-off-by: Daniel J Walsh --- pkg/bindings/connection.go | 15 +++++++-------- pkg/bindings/containers/checkpoint.go | 2 +- pkg/bindings/containers/types.go | 2 +- pkg/bindings/images/images.go | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) (limited to 'pkg/bindings') 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 diff --git a/pkg/bindings/containers/checkpoint.go b/pkg/bindings/containers/checkpoint.go index 916ec8071..8a3932e80 100644 --- a/pkg/bindings/containers/checkpoint.go +++ b/pkg/bindings/containers/checkpoint.go @@ -42,7 +42,7 @@ func Checkpoint(ctx context.Context, nameOrID string, keep, leaveRunning, tcpEst } // Restore restores a checkpointed container to running. The container is identified by the nameOrID option. All -// additional options are optional and allow finer control of the restore processs. +// additional options are optional and allow finer control of the restore process. func Restore(ctx context.Context, nameOrID string, keep, tcpEstablished, ignoreRootFS, ignoreStaticIP, ignoreStaticMAC *bool, name, importArchive *string) (*entities.RestoreReport, error) { var report entities.RestoreReport conn, err := bindings.GetClient(ctx) diff --git a/pkg/bindings/containers/types.go b/pkg/bindings/containers/types.go index 31daaf565..f288c2944 100644 --- a/pkg/bindings/containers/types.go +++ b/pkg/bindings/containers/types.go @@ -12,7 +12,7 @@ type LogOptions struct { Until *string } -// CommitOptions describe details about the resulting commited +// CommitOptions describe details about the resulting committed // image as defined by repo and tag. None of these options // are required. type CommitOptions struct { diff --git a/pkg/bindings/images/images.go b/pkg/bindings/images/images.go index a82a9080b..9cb6a0ac5 100644 --- a/pkg/bindings/images/images.go +++ b/pkg/bindings/images/images.go @@ -394,7 +394,7 @@ func Pull(ctx context.Context, rawImage string, options entities.ImagePullOption } // Push is the binding for libpod's v2 endpoints for push images. Note that -// `source` must be a refering to an image in the remote's container storage. +// `source` must be a referring to an image in the remote's container storage. // The destination must be a reference to a registry (i.e., of docker transport // or be normalized to one). Other transports are rejected as they do not make // sense in a remote context. -- cgit v1.2.3-54-g00ecf