aboutsummaryrefslogtreecommitdiffstats
path: root/utils/fs/fs.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2016-10-24 15:14:22 +0200
committerGitHub <noreply@github.com>2016-10-24 15:14:22 +0200
commitd45eb0402b2f3dace2ed1f91ee53e2c591a7ba3c (patch)
tree7e52ed37c12ec51c6efa3c33c0f38d135bd2c122 /utils/fs/fs.go
parent8cd772a53e8ecd2687b739eea110fa9b179f1e0f (diff)
downloadgo-git-d45eb0402b2f3dace2ed1f91ee53e2c591a7ba3c.tar.gz
utils/fs: move 'os' and 'test' to separate packages. (#93)
* create utils/fs/test package to expose generic test suite to 3rd party fs implementations. * move 'os' to its own package to avoid cyclic dependency (test -> fs -> test, becomes test -> fs, os -> test, os -> fs). * remove TestCreateAndWrite: some of our implementations cannot read a file that was just created, written and not closed yet.
Diffstat (limited to 'utils/fs/fs.go')
-rw-r--r--utils/fs/fs.go19
1 files changed, 3 insertions, 16 deletions
diff --git a/utils/fs/fs.go b/utils/fs/fs.go
index 9be0f88..4eaad15 100644
--- a/utils/fs/fs.go
+++ b/utils/fs/fs.go
@@ -8,13 +8,15 @@ import (
)
var (
- ErrClosed = errors.New("File: Writing on closed file.")
+ ErrClosed = errors.New("file: Writing on closed file.")
ErrReadOnly = errors.New("this is a read-only filesystem")
ErrNotSupported = errors.New("feature not supported")
)
type Filesystem interface {
+ //Create opens a file in write-only mode.
Create(filename string) (File, error)
+ //Open opens a file in read-only mode.
Open(filename string) (File, error)
Stat(filename string) (FileInfo, error)
ReadDir(path string) ([]FileInfo, error)
@@ -35,18 +37,3 @@ type File interface {
}
type FileInfo os.FileInfo
-
-type BaseFile struct {
- filename string
- closed bool
-}
-
-//Filename returns the filename from the File
-func (f *BaseFile) Filename() string {
- return f.filename
-}
-
-//IsClosed returns if te file is closed
-func (f *BaseFile) IsClosed() bool {
- return f.closed
-}