Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated ioutil functions with go 1.16. #212

Merged
merged 2 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pr_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x
go-version: 1.16.x
- name: Restore cache
id: cache
uses: actions/cache@v1
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.14.x]
go-version: [1.16.x]
node-version: [12]
rust-toolchain: [1.49.0]
platform: [ubuntu-latest, macos-latest, windows-latest]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.14.x'
go-version: '1.16.x'
- name: Install Ruby
uses: actions/setup-ruby@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ eval "$(fastly --completion-script-zsh)"

## Development

The Fastly CLI requires [Go 1.13 or above](https://golang.org). Clone this repo
The Fastly CLI requires [Go 1.16 or above](https://golang.org). Clone this repo
to any path and type `make` to run all of the tests and generate a development
build locally.

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/fastly/cli

go 1.14
go 1.16

require (
github.com/BurntSushi/toml v0.3.1
Expand Down
12 changes: 0 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@ github.com/fastly/kingpin v2.1.12-0.20191105091915-95d230a53780+incompatible h1:
github.com/fastly/kingpin v2.1.12-0.20191105091915-95d230a53780+incompatible/go.mod h1:U8UynVoU1SQaqD2I4ZqgYd5lx3A1ipQYn4aSt2Y5h6c=
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/frankban/quicktest v1.5.0 h1:Tb4jWdSpdjKzTUicPnY61PZxKbDoGa7ABbrReT3gQVY=
github.com/frankban/quicktest v1.5.0/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o=
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
github.com/golang/gddo v0.0.0-20190419222130-af0f2af80721 h1:KRMr9A3qfbVM7iV/WcLY/rL5LICqwMHLhwRXKu99fXw=
github.com/golang/gddo v0.0.0-20190419222130-af0f2af80721/go.mod h1:xEhNfoBDX1hzLm2Nf80qUvZ2sVwoMZ8d6IE2SrsQfh4=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
Expand Down Expand Up @@ -135,13 +133,11 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
Expand All @@ -152,36 +148,30 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjN
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e h1:D5TXcfTk7xF7hvieo4QErS3qqCB4teTffacDWr7CI+0=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190729092621-ff9f1409240a/go.mod h1:jcCCGcm9btYwXyDqrUWc6MKQKKGJCWEQ3AfLSRIbEuI=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200624163319-25775e59acb7 h1:LqJsVIMDZN3D7MG8O2vT+ClouLDqeK3YkClIcDzImVs=
golang.org/x/tools v0.0.0-20200624163319-25775e59acb7/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand All @@ -196,9 +186,7 @@ gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
17 changes: 8 additions & 9 deletions pkg/app/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"context"
"fmt"
"io"
"io/ioutil"
"os"
"regexp"
"time"
Expand Down Expand Up @@ -87,7 +86,7 @@ func Run(args []string, env config.Environment, file config.File, configFilePath
// bindings, because we need to do things like track where a config
// parameter came from.
app := kingpin.New("fastly", "A tool to interact with the Fastly API")
app.Writers(out, ioutil.Discard) // don't let kingpin write error output
app.Writers(out, io.Discard) // don't let kingpin write error output
app.UsageContext(&kingpin.UsageContext{
Template: VerboseUsageTemplate,
Funcs: UsageTemplateFuncs,
Expand Down Expand Up @@ -617,17 +616,17 @@ func Run(args []string, env config.Environment, file config.File, configFilePath
// swapping the writer with a no-op and then restoring the real writer
// afterwards. This ensures usage text is only written once to the writer
// and gives us greater control over our error formatting.
app.Writers(ioutil.Discard, ioutil.Discard)
app.Writers(io.Discard, io.Discard)
name, err := app.Parse(args)
if err != nil && !argsIsHelpJSON(args) { // Ignore error if `help --format json`
usage := Usage(args, app, out, ioutil.Discard)
usage := Usage(args, app, out, io.Discard)
return errors.RemediationError{Prefix: usage, Inner: fmt.Errorf("error parsing arguments: %w", err)}
}
if ctx, _ := app.ParseContext(args); contextHasHelpFlag(ctx) {
usage := Usage(args, app, out, ioutil.Discard)
usage := Usage(args, app, out, io.Discard)
return errors.RemediationError{Prefix: usage}
}
app.Writers(out, ioutil.Discard)
app.Writers(out, io.Discard)

// As the `help` command model gets privately added as a side-effect of
// kingping.Parse, we cannot add the `--format json` flag to the model.
Expand All @@ -649,9 +648,9 @@ func Run(args []string, env config.Environment, file config.File, configFilePath
// larger and more verbose help formatting is used.
if name == "help" {
var buf bytes.Buffer
app.Writers(&buf, ioutil.Discard)
app.Writers(&buf, io.Discard)
app.Parse(args)
app.Writers(out, ioutil.Discard)
app.Writers(out, io.Discard)

// The full-fat output of `fastly help` should have a hint at the bottom
// for more specific help. Unfortunately I don't know of a better way to
Expand Down Expand Up @@ -720,7 +719,7 @@ func Run(args []string, env config.Environment, file config.File, configFilePath

command, found := common.SelectCommand(name, commands)
if !found {
usage := Usage(args, app, out, ioutil.Discard)
usage := Usage(args, app, out, io.Discard)
return errors.RemediationError{Prefix: usage, Inner: fmt.Errorf("command not found")}
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/app/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"encoding/json"
"io"
"io/ioutil"
"strings"
"text/template"

Expand Down Expand Up @@ -91,7 +90,7 @@ func UsageJSON(app *kingpin.Application) (string, error) {
// re-assigned to the app via app.Writers after calling Usage.
func Usage(args []string, app *kingpin.Application, out, err io.Writer) string {
var buf bytes.Buffer
app.Writers(&buf, ioutil.Discard)
app.Writers(&buf, io.Discard)
app.UsageContext(&kingpin.UsageContext{
Template: CompactUsageTemplate,
Funcs: UsageTemplateFuncs,
Expand Down
25 changes: 12 additions & 13 deletions pkg/compute/compute_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
Expand Down Expand Up @@ -349,7 +348,7 @@ func TestInit(t *testing.T) {
testutil.AssertStringContains(t, buf.String(), s)
}
if testcase.manifestIncludes != "" {
content, err := ioutil.ReadFile(filepath.Join(rootdir, compute.ManifestFilename))
content, err := os.ReadFile(filepath.Join(rootdir, compute.ManifestFilename))
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -885,7 +884,7 @@ func TestDeploy(t *testing.T) {
testutil.AssertStringContains(t, buf.String(), s)
}
if testcase.manifestIncludes != "" {
content, err := ioutil.ReadFile(filepath.Join(rootdir, compute.ManifestFilename))
content, err := os.ReadFile(filepath.Join(rootdir, compute.ManifestFilename))
if err != nil {
t.Fatal(err)
}
Expand Down Expand Up @@ -1028,7 +1027,7 @@ func TestValidate(t *testing.T) {
func makeInitEnvironment(t *testing.T, manifestContent string) (rootdir string) {
t.Helper()

rootdir, err := ioutil.TempDir("", "fastly-init-*")
rootdir, err := os.MkdirTemp("", "fastly-init-*")
if err != nil {
t.Fatal(err)
}
Expand All @@ -1039,7 +1038,7 @@ func makeInitEnvironment(t *testing.T, manifestContent string) (rootdir string)

if manifestContent != "" {
filename := filepath.Join(rootdir, compute.ManifestFilename)
if err := ioutil.WriteFile(filename, []byte(manifestContent), 0777); err != nil {
if err := os.WriteFile(filename, []byte(manifestContent), 0777); err != nil {
t.Fatal(err)
}
}
Expand All @@ -1050,7 +1049,7 @@ func makeInitEnvironment(t *testing.T, manifestContent string) (rootdir string)
func makeRustBuildEnvironment(t *testing.T, fastlyManifestContent, cargoManifestContent, cargoLockContent string) (rootdir string) {
t.Helper()

rootdir, err := ioutil.TempDir("", "fastly-build-*")
rootdir, err := os.MkdirTemp("", "fastly-build-*")
if err != nil {
t.Fatal(err)
}
Expand All @@ -1071,21 +1070,21 @@ func makeRustBuildEnvironment(t *testing.T, fastlyManifestContent, cargoManifest

if fastlyManifestContent != "" {
filename := filepath.Join(rootdir, compute.ManifestFilename)
if err := ioutil.WriteFile(filename, []byte(fastlyManifestContent), 0777); err != nil {
if err := os.WriteFile(filename, []byte(fastlyManifestContent), 0777); err != nil {
t.Fatal(err)
}
}

if cargoManifestContent != "" {
filename := filepath.Join(rootdir, "Cargo.toml")
if err := ioutil.WriteFile(filename, []byte(cargoManifestContent), 0777); err != nil {
if err := os.WriteFile(filename, []byte(cargoManifestContent), 0777); err != nil {
t.Fatal(err)
}
}

if cargoLockContent != "" {
filename := filepath.Join(rootdir, "Cargo.lock")
if err := ioutil.WriteFile(filename, []byte(cargoLockContent), 0777); err != nil {
if err := os.WriteFile(filename, []byte(cargoLockContent), 0777); err != nil {
t.Fatal(err)
}
}
Expand All @@ -1096,7 +1095,7 @@ func makeRustBuildEnvironment(t *testing.T, fastlyManifestContent, cargoManifest
func makeAssemblyScriptBuildEnvironment(t *testing.T, fastlyManifestContent string) (rootdir string) {
t.Helper()

rootdir, err := ioutil.TempDir("", "fastly-build-*")
rootdir, err := os.MkdirTemp("", "fastly-build-*")
if err != nil {
t.Fatal(err)
}
Expand All @@ -1116,7 +1115,7 @@ func makeAssemblyScriptBuildEnvironment(t *testing.T, fastlyManifestContent stri

if fastlyManifestContent != "" {
filename := filepath.Join(rootdir, compute.ManifestFilename)
if err := ioutil.WriteFile(filename, []byte(fastlyManifestContent), 0777); err != nil {
if err := os.WriteFile(filename, []byte(fastlyManifestContent), 0777); err != nil {
t.Fatal(err)
}
}
Expand All @@ -1133,7 +1132,7 @@ func makeAssemblyScriptBuildEnvironment(t *testing.T, fastlyManifestContent stri
func makeDeployEnvironment(t *testing.T, manifestContent string) (rootdir string) {
t.Helper()

rootdir, err := ioutil.TempDir("", "fastly-deploy-*")
rootdir, err := os.MkdirTemp("", "fastly-deploy-*")
if err != nil {
t.Fatal(err)
}
Expand All @@ -1152,7 +1151,7 @@ func makeDeployEnvironment(t *testing.T, manifestContent string) (rootdir string

if manifestContent != "" {
filename := filepath.Join(rootdir, compute.ManifestFilename)
if err := ioutil.WriteFile(filename, []byte(manifestContent), 0777); err != nil {
if err := os.WriteFile(filename, []byte(manifestContent), 0777); err != nil {
t.Fatal(err)
}
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/compute/compute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"crypto/rand"
"errors"
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
Expand Down Expand Up @@ -481,7 +480,7 @@ func makeBuildEnvironment(t *testing.T, fastlyIgnoreContent string) (rootdir str

if fastlyIgnoreContent != "" {
filename := filepath.Join(rootdir, IgnoreFilePath)
if err := ioutil.WriteFile(filename, []byte(fastlyIgnoreContent), 0777); err != nil {
if err := os.WriteFile(filename, []byte(fastlyIgnoreContent), 0777); err != nil {
t.Fatal(err)
}
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/compute/rust.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"os/exec"
Expand Down Expand Up @@ -376,7 +375,7 @@ func getLatestCrateVersion(client api.HTTPClient, name string) (*semver.Version,
return nil, fmt.Errorf("error fetching latest crate version: %s", resp.Status)
}

body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/configure/configure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bytes"
"errors"
"io"
"io/ioutil"
"net/http"
"os"
"strings"
Expand Down Expand Up @@ -214,7 +213,7 @@ func TestConfigure(t *testing.T) {
testutil.AssertStringContains(t, out.String(), s)
}
if testcase.wantError == "" {
p, err := ioutil.ReadFile(configFilePath)
p, err := os.ReadFile(configFilePath)
testutil.AssertNoError(t, err)
testutil.AssertString(t, strings.Join(testcase.wantFile, "\n")+"\n", string(p))
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/edgedictionaryitem/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"

"github.com/fastly/cli/pkg/common"
Expand Down Expand Up @@ -49,7 +48,7 @@ func (c *BatchCommand) Exec(in io.Reader, out io.Writer) error {
return err
}

jsonBytes, err := ioutil.ReadAll(jsonFile)
jsonBytes, err := io.ReadAll(jsonFile)
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/logs/tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -216,7 +215,7 @@ func (c *TailCommand) tail(out io.Writer) {

// Reuse the connection for the retry, or cleanup in the
// case of Exit.
io.Copy(ioutil.Discard, resp.Body)
io.Copy(io.Discard, resp.Body)
resp.Body.Close()

// Try the response again after a 1 second wait.
Expand Down
Loading