Created
June 25, 2012 16:42
-
-
Save nutrun/2989671 to your computer and use it in GitHub Desktop.
golang filsystem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"os" | |
"io" | |
) | |
var fs fileSystem = osFS{} | |
type file interface { | |
io.Closer | |
io.Reader | |
io.ReaderAt | |
io.Seeker | |
Stat() (os.FileInfo, error) | |
} | |
type fileSystem interface { | |
Open(name string) (file, error) | |
Stat(name string) (os.FileInfo, error) | |
} | |
type osFS struct{} | |
func (osFS) Open(name string) (file, error) { | |
return os.Open(name) | |
} | |
func (osFS) Stat(name string) (os.FileInfo, error) { | |
return os.Stat(name) | |
} | |
func main() { | |
println("you suck") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment