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

Issue 20110045: code review 20110045: [release-branch.go1.2] os: do not return Lstat errors f... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 5 months ago by adg
Modified:
10 years, 5 months ago
Reviewers:
dsymonds
CC:
golang-dev
Visibility:
Public.

Description

[release-branch.go1.2] os: do not return Lstat errors from Readdir ««« CL 18870043 / eca0ca43a863 os: do not return Lstat errors from Readdir This CL restores the Go 1.1.2 semantics for os.File's Readdir method. The code in Go 1.1.2 was rewritten mainly because it looked buggy. This new version attempts to be clearer but still provide the 1.1.2 results. The important diff is not this CL's version against tip but this CL's version against Go 1.1.2. Go 1.1.2: names, err := f.Readdirnames(n) fi = make([]FileInfo, len(names)) for i, filename := range names { fip, err := Lstat(dirname + filename) if err == nil { fi[i] = fip } else { fi[i] = &fileStat{name: filename} } } return fi, err This CL: names, err := f.Readdirnames(n) fi = make([]FileInfo, len(names)) for i, filename := range names { fip, lerr := lstat(dirname + filename) if lerr != nil { fi[i] = &fileStat{name: filename} continue } fi[i] = fip } return fi, err The changes from Go 1.1.2 are stylistic, not semantic: 1. Use lstat instead of Lstat, for testing (done before this CL). 2. Make error handling in loop body look more like an error case. 3. Use separate error variable name in loop body, to be clear we are not trying to influence the final return result. Fixes issue 6656. Fixes issue 6680. R=golang-dev, bradfitz CC=golang-dev https://codereview.appspot.com/18870043 »»»

Patch Set 1 #

Patch Set 2 : diff -r 937a9051a250 https://code.google.com/p/go #

Patch Set 3 : diff -r 937a9051a250 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+5 lines, -8 lines) Patch
M src/pkg/os/file_unix.go View 1 1 chunk +3 lines, -6 lines 0 comments Download
M src/pkg/os/os_unix_test.go View 1 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 3
adg
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
10 years, 5 months ago (2013-11-01 00:26:14 UTC) #1
adg
*** Submitted as https://code.google.com/p/go/source/detail?r=b7ce8f68901f *** [release-branch.go1.2] os: do not return Lstat errors from Readdir ««« ...
10 years, 5 months ago (2013-11-01 00:26:41 UTC) #2
dsymonds
10 years, 5 months ago (2013-11-01 00:27:03 UTC) #3
LGTM
Sign in to reply to this message.

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