Update staticcheck version and fix all warnings (#1381)

This commit is contained in:
Ta-Ching Chen
2019-11-05 18:09:12 +08:00
committed by GitHub
parent 93d4b88d84
commit b9a5588ca9
43 changed files with 122 additions and 219 deletions
+3 -3
View File
@@ -20,7 +20,6 @@ import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"io/ioutil"
@@ -30,6 +29,7 @@ import (
"os"
"strings"
"github.com/pkg/errors"
"go.opencensus.io/plugin/ochttp"
"golang.org/x/net/context/ctxhttp"
@@ -127,7 +127,7 @@ func (c *Client) Download(ctx context.Context, id string, filePath string) error
// quit if file exists
_, err := os.Stat(filePath)
if err == nil || !os.IsNotExist(err) {
return errors.New(fmt.Sprintf("file already exists: %v", filePath))
return errors.Errorf("file already exists: %v", filePath)
}
// create
@@ -175,7 +175,7 @@ func (c *Client) Delete(ctx context.Context, id string) error {
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return errors.New(fmt.Sprintf("HTTP error %v", resp.StatusCode))
return errors.Errorf("HTTP error %v", resp.StatusCode)
}
return nil