Fix a few more golint warnings.
authorWard Vandewege <ward@curii.com>
Sun, 28 Feb 2021 22:13:03 +0000 (17:13 -0500)
committerWard Vandewege <ward@curii.com>
Sun, 28 Feb 2021 22:13:03 +0000 (17:13 -0500)
No issue #

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

lib/boot/cert.go
lib/crunchrun/container_gateway.go
sdk/go/arvados/client.go

index b2b8c896c2866bceeb399475d5aa7e6cc2dea75c..2b38dab053cd63d571a00bf4d791f90b328c979c 100644 (file)
@@ -32,14 +32,14 @@ func (createCertificates) Run(ctx context.Context, fail func(error), super *Supe
        } else {
                san += fmt.Sprintf(",DNS:%s", super.ListenHost)
        }
-       if hostname, err := os.Hostname(); err != nil {
+       hostname, err := os.Hostname()
+       if err != nil {
                return fmt.Errorf("hostname: %w", err)
-       } else {
-               san += ",DNS:" + hostname
        }
+       san += ",DNS:" + hostname
 
        // Generate root key
-       err := super.RunProgram(ctx, super.tempdir, runOptions{}, "openssl", "genrsa", "-out", "rootCA.key", "4096")
+       err = super.RunProgram(ctx, super.tempdir, runOptions{}, "openssl", "genrsa", "-out", "rootCA.key", "4096")
        if err != nil {
                return err
        }
index 1116c4bb1285d11ae39b4e194f21df6fd01c5d24..19feac1696c473c4df8a6f65eb6a9d1422cc8e2f 100644 (file)
@@ -49,9 +49,8 @@ func (gw *Gateway) Start() error {
                PasswordCallback: func(c ssh.ConnMetadata, pass []byte) (*ssh.Permissions, error) {
                        if c.User() == "_" {
                                return nil, nil
-                       } else {
-                               return nil, fmt.Errorf("cannot specify user %q via ssh client", c.User())
                        }
+                       return nil, fmt.Errorf("cannot specify user %q via ssh client", c.User())
                },
                PublicKeyCallback: func(c ssh.ConnMetadata, pubKey ssh.PublicKey) (*ssh.Permissions, error) {
                        if c.User() == "_" {
@@ -60,9 +59,8 @@ func (gw *Gateway) Start() error {
                                                "pubkey-fp": ssh.FingerprintSHA256(pubKey),
                                        },
                                }, nil
-                       } else {
-                               return nil, fmt.Errorf("cannot specify user %q via ssh client", c.User())
                        }
+                       return nil, fmt.Errorf("cannot specify user %q via ssh client", c.User())
                },
        }
        pvt, err := rsa.GenerateKey(rand.Reader, 2048)
index ea3cb6899e7bd5ac9f92cc0d3127e6aa3a485f13..13bb3bf80de70c11e4567ab69ea56c9c03b28a8f 100644 (file)
@@ -321,9 +321,8 @@ func (c *Client) RequestAndDecodeContext(ctx context.Context, dst interface{}, m
        if c.APIHost == "" {
                if c.loadedFromEnv {
                        return errors.New("ARVADOS_API_HOST and/or ARVADOS_API_TOKEN environment variables are not set")
-               } else {
-                       return errors.New("arvados.Client cannot perform request: APIHost is not set")
                }
+               return errors.New("arvados.Client cannot perform request: APIHost is not set")
        }
        urlString := c.apiURL(path)
        urlValues, err := anythingToValues(params)