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

Drop use of deprecated ioutil package #117

Merged
merged 1 commit into from Aug 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 5 additions & 8 deletions nocmp_test.go
Expand Up @@ -22,7 +22,6 @@ package atomic

import (
"bytes"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -134,23 +133,21 @@ func shouldNotCompile() {
`

func TestNocmpIntegration(t *testing.T) {
tempdir, err := ioutil.TempDir("", "nocmp")
require.NoError(t, err, "unable to set up temporary directory")
defer os.RemoveAll(tempdir)
tempdir := t.TempDir()

nocmp, err := ioutil.ReadFile("nocmp.go")
nocmp, err := os.ReadFile("nocmp.go")
require.NoError(t, err, "unable to read nocmp.go")

require.NoError(t,
ioutil.WriteFile(filepath.Join(tempdir, "go.mod"), []byte(_exampleGoMod), 0644),
os.WriteFile(filepath.Join(tempdir, "go.mod"), []byte(_exampleGoMod), 0o644),
"unable to write go.mod")

require.NoError(t,
ioutil.WriteFile(filepath.Join(tempdir, "nocmp.go"), nocmp, 0644),
os.WriteFile(filepath.Join(tempdir, "nocmp.go"), nocmp, 0o644),
"unable to write nocmp.go")

require.NoError(t,
ioutil.WriteFile(filepath.Join(tempdir, "bad.go"), []byte(_badFile), 0644),
os.WriteFile(filepath.Join(tempdir, "bad.go"), []byte(_badFile), 0o644),
"unable to write bad.go")

var stderr bytes.Buffer
Expand Down