Skip to content

Instantly share code, notes, and snippets.

@nutrun
Created June 25, 2012 16:42
Show Gist options
  • Save nutrun/2989671 to your computer and use it in GitHub Desktop.
Save nutrun/2989671 to your computer and use it in GitHub Desktop.
golang filsystem
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