Skip to content

Commit

Permalink
replace deprecated ioutil.TempFile with os.CreateTemp
Browse files Browse the repository at this point in the history
Summary:
title
see D55114336 for summary

Reviewed By: awalterschulze

Differential Revision: D55114335

fbshipit-source-id: 980741dde52edddc568bf21b43e5a59c893dab2d
  • Loading branch information
Surya Ahuja authored and facebook-github-bot committed Mar 25, 2024
1 parent 8e88e51 commit 08dc285
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions dnsrocks/go-cdb-mods/cdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"bytes"
"fmt"
"io"
"io/ioutil"
"os"
"testing"
)
Expand All @@ -24,7 +23,7 @@ var records = []rec{
var data []byte // set by init()

func TestCdb(t *testing.T) {
tmp, err := ioutil.TempFile("", "")
tmp, err := os.CreateTemp("", "")
if err != nil {
t.Fatalf("Failed to create temp file: %s", err)
}
Expand Down Expand Up @@ -100,7 +99,7 @@ func TestCdb(t *testing.T) {
}

func TestEmptyFile(t *testing.T) {
tmp, err := ioutil.TempFile("", "")
tmp, err := os.CreateTemp("", "")
if err != nil {
t.Fatalf("Failed to create temp file: %s", err)
}
Expand Down
3 changes: 1 addition & 2 deletions dnsrocks/go-cdb-mods/cdbmake/cdbmake.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"bufio"
"flag"
"fmt"
"io/ioutil"
"os"
"path"

Expand All @@ -31,7 +30,7 @@ func main() {
args := flag.Args()
if len(args) == 1 {
dir, _ := path.Split(args[0])
tmp, err = ioutil.TempFile(dir, "")
tmp, err = os.CreateTemp(dir, "")
exitOnErr(err)
} else if len(args) == 2 {
tmp, err = os.OpenFile(args[1], os.O_RDWR|os.O_CREATE, 0644)
Expand Down

0 comments on commit 08dc285

Please sign in to comment.