Update to go1.16

This commit is contained in:
Romain 2021-03-04 20:08:03 +01:00 committed by GitHub
parent 2e7833df49
commit bdba7d3adf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 217 additions and 318 deletions

View file

@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
@ -68,7 +67,7 @@ func NewClient(opts ClientOptions) (*Client, error) {
return nil, err
}
goPath, err := ioutil.TempDir(sourcesRootPath, "gop-*")
goPath, err := os.MkdirTemp(sourcesRootPath, "gop-*")
if err != nil {
return nil, fmt.Errorf("failed to create GoPath: %w", err)
}
@ -197,7 +196,7 @@ func (c *Client) Download(ctx context.Context, pName, pVersion string) (string,
return hash, nil
}
data, _ := ioutil.ReadAll(resp.Body)
data, _ := io.ReadAll(resp.Body)
return "", fmt.Errorf("error: %d: %s", resp.StatusCode, string(data))
}
@ -353,7 +352,7 @@ func (c *Client) WriteState(plugins map[string]Descriptor) error {
return err
}
return ioutil.WriteFile(c.stateFile, mp, 0o600)
return os.WriteFile(c.stateFile, mp, 0o600)
}
// ResetAll resets all plugins related directories.