github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/io/fs/util_test.go (about)

     1  package fs_test
     2  
     3  import (
     4  	"io/ioutil"
     5  	"os"
     6  
     7  	. "github.com/smartystreets/goconvey/convey"
     8  )
     9  
    10  func tempFile() (*os.File, func()) {
    11  	file, err := ioutil.TempFile("", "fstest")
    12  	So(err, ShouldBeNil)
    13  
    14  	fn := func() {
    15  		file.Close()
    16  		os.Remove(file.Name())
    17  	}
    18  
    19  	return file, fn
    20  }