Start a testutils package.
This commit is contained in:
parent
c90d9ccc39
commit
3b215bc8b2
|
@ -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
|
||||||
|
}
|
Loading…
Reference in New Issue