diff options
Diffstat (limited to 'test/file.go')
-rw-r--r-- | test/file.go | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/test/file.go b/test/file.go deleted file mode 100644 index 626224cac..000000000 --- a/test/file.go +++ /dev/null @@ -1,19 +0,0 @@ -package test - -import ( - "io/ioutil" - "os" -) - -// TempFile will create a temporary file on disk and returns the name and a cleanup function to remove it later. -func TempFile(dir, content string) (string, func(), error) { - f, err := ioutil.TempFile(dir, "go-test-tmpfile") - if err != nil { - return "", nil, err - } - if err := ioutil.WriteFile(f.Name(), []byte(content), 0644); err != nil { - return "", nil, err - } - rmFunc := func() { os.Remove(f.Name()) } - return f.Name(), rmFunc, nil -} |