{"action":"created","issue":{"url":"https://api.github.com/repos/omeid/go-resources/issues/4","repository_url":"https://api.github.com/repos/omeid/go-resources","labels_url":"https://api.github.com/repos/omeid/go-resources/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/omeid/go-resources/issues/4/comments","events_url":"https://api.github.com/repos/omeid/go-resources/issues/4/events","html_url":"https://github.com/omeid/go-resources/issues/4","id":136018358,"number":4,"title":"Can't readdir files in \"/\"","user":{"login":"pstibrany","id":895919,"avatar_url":"https://avatars.githubusercontent.com/u/895919?v=3","gravatar_id":"","url":"https://api.github.com/users/pstibrany","html_url":"https://github.com/pstibrany","followers_url":"https://api.github.com/users/pstibrany/followers","following_url":"https://api.github.com/users/pstibrany/following{/other_user}","gists_url":"https://api.github.com/users/pstibrany/gists{/gist_id}","starred_url":"https://api.github.com/users/pstibrany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pstibrany/subscriptions","organizations_url":"https://api.github.com/users/pstibrany/orgs","repos_url":"https://api.github.com/users/pstibrany/repos","events_url":"https://api.github.com/users/pstibrany/events{/privacy}","received_events_url":"https://api.github.com/users/pstibrany/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-24T10:27:59Z","updated_at":"2016-02-24T15:30:27Z","closed_at":null,"body":"Right now following code returns error (where `fs` is generated http.FileSystem implementation), and doesn't return list of files.\r\n\r\n```go\r\n\td, err := fs.Open(\"/\")\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tfiles, err := d.Readdir(0)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n```\r\n\r\nHere is a patch that fixes that:\r\n\r\n```patch\r\ndiff --git a/resources.go b/resources.go\r\nindex daeccd7..4591958 100644\r\n--- a/resources.go\r\n+++ b/resources.go\r\n@@ -188,6 +188,10 @@ func (f *File) Close() error {\r\n }\r\n \r\n func (f *File) Readdir(count int) ([]os.FileInfo, error) {\r\n+  if f.fi.isDir {\r\n+    return f.fi.files, nil\r\n+  }\r\n+\r\n   return nil, os.ErrNotExist\r\n }\r\n \r\n@@ -226,10 +230,6 @@ func (f *FileInfo) IsDir() bool {\r\n        return f.isDir\r\n }\r\n \r\n-func (f *FileInfo) Readdir(count int) ([]os.FileInfo, error) {\r\n-       return f.files, nil\r\n-}\r\n-\r\n func (f *FileInfo) Sys() interface{} {\r\n        return f.sys\r\n }\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/omeid/go-resources/issues/comments/188306255","html_url":"https://github.com/omeid/go-resources/issues/4#issuecomment-188306255","issue_url":"https://api.github.com/repos/omeid/go-resources/issues/4","id":188306255,"user":{"login":"pstibrany","id":895919,"avatar_url":"https://avatars.githubusercontent.com/u/895919?v=3","gravatar_id":"","url":"https://api.github.com/users/pstibrany","html_url":"https://github.com/pstibrany","followers_url":"https://api.github.com/users/pstibrany/followers","following_url":"https://api.github.com/users/pstibrany/following{/other_user}","gists_url":"https://api.github.com/users/pstibrany/gists{/gist_id}","starred_url":"https://api.github.com/users/pstibrany/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pstibrany/subscriptions","organizations_url":"https://api.github.com/users/pstibrany/orgs","repos_url":"https://api.github.com/users/pstibrany/repos","events_url":"https://api.github.com/users/pstibrany/events{/privacy}","received_events_url":"https://api.github.com/users/pstibrany/received_events","type":"User","site_admin":false},"created_at":"2016-02-24T15:30:27Z","updated_at":"2016-02-24T15:30:27Z","body":"Oh, that's right. I always use it with 0, so my fix works for my case :)"}}