Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(83)

Delta Between Two Patch Sets: src/cmd/godoc/filesystem.go

Issue 5416060: code review 5416060: io: new FileInfo, FileMode types + update tree (Closed)
Left Patch Set: diff -r 0c75ae21c217 https://go.googlecode.com/hg/ Created 13 years, 4 months ago
Right Patch Set: diff -r d917a203b389 https://go.googlecode.com/hg/ Created 13 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/godoc/dirtrees.go ('k') | src/cmd/godoc/godoc.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2011 The Go Authors. All rights reserved. 1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // This file defines types for abstract file system access and 5 // This file defines types for abstract file system access and
6 // provides an implementation accessing the file system of the 6 // provides an implementation accessing the file system of the
7 // underlying OS. 7 // underlying OS.
8 8
9 package main 9 package main
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 func (osFS) Open(path string) (io.ReadCloser, error) { 45 func (osFS) Open(path string) (io.ReadCloser, error) {
46 f, err := os.Open(path) 46 f, err := os.Open(path)
47 if err != nil { 47 if err != nil {
48 return nil, err 48 return nil, err
49 } 49 }
50 fi, err := f.Stat() 50 fi, err := f.Stat()
51 if err != nil { 51 if err != nil {
52 return nil, err 52 return nil, err
53 } 53 }
54 » if fi.Mode().IsDir() { 54 » if fi.IsDir() {
55 return nil, fmt.Errorf("Open: %s is a directory", path) 55 return nil, fmt.Errorf("Open: %s is a directory", path)
56 } 56 }
57 return f, nil 57 return f, nil
58 } 58 }
59 59
60 func (osFS) Lstat(path string) (os.FileInfo, error) { 60 func (osFS) Lstat(path string) (os.FileInfo, error) {
61 return os.Lstat(path) 61 return os.Lstat(path)
62 } 62 }
63 63
64 func (osFS) Stat(path string) (os.FileInfo, error) { 64 func (osFS) Stat(path string) (os.FileInfo, error) {
65 return os.Stat(path) 65 return os.Stat(path)
66 } 66 }
67 67
68 func (osFS) ReadDir(path string) ([]os.FileInfo, error) { 68 func (osFS) ReadDir(path string) ([]os.FileInfo, error) {
69 return ioutil.ReadDir(path) // is sorted 69 return ioutil.ReadDir(path) // is sorted
70 } 70 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b