From 3b215bc8b2d7b57997b736ec22f63e8ccc5cfdeb Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Thu, 28 Apr 2016 11:33:41 -0700 Subject: [PATCH] Start a testutils package. --- testutil/testutil.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 testutil/testutil.go diff --git a/testutil/testutil.go b/testutil/testutil.go new file mode 100644 index 0000000..8490e43 --- /dev/null +++ b/testutil/testutil.go @@ -0,0 +1,16 @@ +package testutil + +import "io/ioutil" + +// TempName generates a new temporary file name. The caller should +// remove the temporary file when done. +func TempName() (string, error) { + tmpf, err := ioutil.TempFile("", "transport_cachedkp_") + if err != nil { + return "", err + } + + name := tmpf.Name() + tmpf.Close() + return name, nil +}