Skip to content

Commit

Permalink
chore: replace deprecated ioutil.TempDir with os.MkdirTemp (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear authored Jun 13, 2024
1 parent 84015fd commit 6539ccd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docker/pkg/ioutils/temp_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package ioutils // import "github.com/ory/dockertest/v3/docker/pkg/ioutils"

import "os"

// TempDir on Unix systems is equivalent to ioutil.TempDir.
// TempDir on Unix systems is equivalent to os.MkdirTemp.
func TempDir(dir, prefix string) (string, error) {
return os.MkdirTemp(dir, prefix)
}
6 changes: 3 additions & 3 deletions docker/pkg/ioutils/temp_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
package ioutils // import "github.com/ory/dockertest/v3/docker/pkg/ioutils"

import (
"io/ioutil"
"os"

"github.com/ory/dockertest/v3/docker/pkg/longpath"
)

// TempDir is the equivalent of ioutil.TempDir, except that the result is in Windows longpath format.
// TempDir is the equivalent of os.MkdirTemp, except that the result is in Windows longpath format.
func TempDir(dir, prefix string) (string, error) {
tempDir, err := ioutil.TempDir(dir, prefix)
tempDir, err := os.MkdirTemp(dir, prefix)
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion docker/pkg/system/filesys_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func nextSuffix() string {
return strconv.Itoa(int(1e9 + r%1e9))[1:]
}

// TempFileSequential is a copy of ioutil.TempFile, modified to use sequential
// TempFileSequential is a copy of os.CreateTemp, modified to use sequential
// file access. Below is the original comment from golang:
// TempFile creates a new temporary file in the directory dir
// with a name beginning with prefix, opens the file for reading
Expand Down

0 comments on commit 6539ccd

Please sign in to comment.