From 43af5f57d2de2cb5657e252c2f327e1213057f67 Mon Sep 17 00:00:00 2001 From: Ward Vandewege Date: Sun, 28 Feb 2021 17:13:03 -0500 Subject: [PATCH] Fix a few more golint warnings. No issue # Arvados-DCO-1.1-Signed-off-by: Ward Vandewege --- lib/boot/cert.go | 8 ++++---- lib/crunchrun/container_gateway.go | 6 ++---- sdk/go/arvados/client.go | 3 +-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/boot/cert.go b/lib/boot/cert.go index b2b8c896c2..2b38dab053 100644 --- a/lib/boot/cert.go +++ b/lib/boot/cert.go @@ -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 } diff --git a/lib/crunchrun/container_gateway.go b/lib/crunchrun/container_gateway.go index 1116c4bb12..19feac1696 100644 --- a/lib/crunchrun/container_gateway.go +++ b/lib/crunchrun/container_gateway.go @@ -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) diff --git a/sdk/go/arvados/client.go b/sdk/go/arvados/client.go index ea3cb6899e..13bb3bf80d 100644 --- a/sdk/go/arvados/client.go +++ b/sdk/go/arvados/client.go @@ -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) -- 2.30.2