Remove io.Writer from fs.File
It was only used in a single test, which now uses plain *os.File instead.
This commit is contained in:
parent
9abef3bf1a
commit
1b20f6beec
4 changed files with 32 additions and 41 deletions
|
@ -1,10 +1,6 @@
|
|||
package fs
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
import "os"
|
||||
|
||||
// IsRegularFile returns true if fi belongs to a normal file. If fi is nil,
|
||||
// false is returned.
|
||||
|
@ -15,22 +11,3 @@ func IsRegularFile(fi os.FileInfo) bool {
|
|||
|
||||
return fi.Mode()&(os.ModeType|os.ModeCharDevice) == 0
|
||||
}
|
||||
|
||||
// TestTempFile returns a new temporary file, which is removed when cleanup()
|
||||
// is called.
|
||||
func TestTempFile(t testing.TB, prefix string) (File, func()) {
|
||||
f, err := ioutil.TempFile("", prefix)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
cleanup := func() {
|
||||
_ = f.Close()
|
||||
err = Remove(f.Name())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
return f, cleanup
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue