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

Issue 5014043: code review 5014043: path/filepath: new signature for Walk (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 10 months ago by r
Modified:
13 years, 10 months ago
Reviewers:
borman, rog
CC:
golang-dev, gri, rsc, r2, cw, niemeyer
Visibility:
Public.

Description

path/filepath: new signature for Walk This one uses a closure than an interface, and is much simpler to use. It also enables a called function to return an error and (possibly) halt processing. Fixes issue 2237.

Patch Set 1 #

Total comments: 13

Patch Set 2 : diff -r 53aca9374761 https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 3 : diff -r 53aca9374761 https://go.googlecode.com/hg/ #

Total comments: 7

Patch Set 4 : diff -r 53aca9374761 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 53aca9374761 https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 53aca9374761 https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 7 : diff -r fe9f0d3b9825 https://go.googlecode.com/hg/ #

Patch Set 8 : diff -r fe9f0d3b9825 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+124 lines, -153 lines) Patch
M src/cmd/gofix/main.go View 1 2 3 4 1 chunk +8 lines, -22 lines 0 comments Download
M src/cmd/gofmt/gofmt.go View 1 2 3 4 1 chunk +8 lines, -22 lines 0 comments Download
M src/cmd/govet/govet.go View 1 2 3 4 5 6 1 chunk +8 lines, -22 lines 0 comments Download
M src/pkg/path/filepath/path.go View 1 2 3 4 5 6 7 2 chunks +41 lines, -35 lines 0 comments Download
M src/pkg/path/filepath/path_test.go View 1 2 3 chunks +59 lines, -52 lines 0 comments Download

Messages

Total messages: 38
r
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 10 months ago (2011-09-13 21:48:58 UTC) #1
gri
http://codereview.appspot.com/5014043/diff/1/src/cmd/govet/govet.go File src/cmd/govet/govet.go (right): http://codereview.appspot.com/5014043/diff/1/src/cmd/govet/govet.go#newcode105 src/cmd/govet/govet.go:105: if f.IsRegular() && strings.HasSuffix(path, ".go") { fyi: in gofmt ...
13 years, 10 months ago (2011-09-13 22:12:33 UTC) #2
rsc
What is the reason to use select? It looks like it is guarding against broken ...
13 years, 10 months ago (2011-09-13 22:24:42 UTC) #3
r2
On Sep 13, 2011, at 3:24 PM, Russ Cox wrote: > What is the reason ...
13 years, 10 months ago (2011-09-13 22:27:31 UTC) #4
r
http://codereview.appspot.com/5014043/diff/1/src/pkg/path/filepath/path.go File src/pkg/path/filepath/path.go (right): http://codereview.appspot.com/5014043/diff/1/src/pkg/path/filepath/path.go#newcode267 src/pkg/path/filepath/path.go:267: var ( On 2011/09/13 22:12:33, gri wrote: > ()'s ...
13 years, 10 months ago (2011-09-13 22:27:53 UTC) #5
r
Hello golang-dev@googlegroups.com, gri@golang.org, rsc@golang.org, r@google.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 10 months ago (2011-09-13 22:28:08 UTC) #6
r2
never mind, API #4 coming up
13 years, 10 months ago (2011-09-13 22:35:00 UTC) #7
cw
http://codereview.appspot.com/5014043/diff/8002/src/pkg/path/filepath/path.go File src/pkg/path/filepath/path.go (right): http://codereview.appspot.com/5014043/diff/8002/src/pkg/path/filepath/path.go#newcode274 src/pkg/path/filepath/path.go:274: if errors != nil && errors != IgnoreWalkErrors { ...
13 years, 10 months ago (2011-09-13 22:55:52 UTC) #8
r
Hello golang-dev@googlegroups.com, gri@golang.org, rsc@golang.org, r@google.com, cw@f00f.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 10 months ago (2011-09-13 23:14:16 UTC) #9
rsc
LGTM http://codereview.appspot.com/5014043/diff/13001/src/pkg/path/filepath/path.go File src/pkg/path/filepath/path.go (right): http://codereview.appspot.com/5014043/diff/13001/src/pkg/path/filepath/path.go#newcode263 src/pkg/path/filepath/path.go:263: // WalkFn is the type of the function ...
13 years, 10 months ago (2011-09-13 23:27:15 UTC) #10
cw
I like the ease of use of the new interface but it's not clear how ...
13 years, 10 months ago (2011-09-13 23:27:48 UTC) #11
r2
On Sep 13, 2011, at 4:27 PM, cw@f00f.org wrote: > I like the ease of ...
13 years, 10 months ago (2011-09-13 23:29:05 UTC) #12
r
http://codereview.appspot.com/5014043/diff/13001/src/pkg/path/filepath/path.go File src/pkg/path/filepath/path.go (right): http://codereview.appspot.com/5014043/diff/13001/src/pkg/path/filepath/path.go#newcode302 src/pkg/path/filepath/path.go:302: // If root cannot be stat'ed, an error is ...
13 years, 10 months ago (2011-09-13 23:31:28 UTC) #13
rsc
On Tue, Sep 13, 2011 at 19:31, <r@golang.org> wrote: > because it means that that ...
13 years, 10 months ago (2011-09-13 23:33:00 UTC) #14
r2
On Sep 13, 2011, at 4:32 PM, Russ Cox wrote: > On Tue, Sep 13, ...
13 years, 10 months ago (2011-09-13 23:33:23 UTC) #15
gri
http://codereview.appspot.com/5014043/diff/13001/src/cmd/gofix/main.go File src/cmd/gofix/main.go (right): http://codereview.appspot.com/5014043/diff/13001/src/cmd/gofix/main.go#newcode211 src/cmd/gofix/main.go:211: } if err == nil && isGoFile(f) { err ...
13 years, 10 months ago (2011-09-13 23:34:56 UTC) #16
r
Hello golang-dev@googlegroups.com, gri@golang.org, rsc@golang.org, r@google.com, cw@f00f.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 10 months ago (2011-09-13 23:35:57 UTC) #17
cw
On Tue, Sep 13, 2011 at 04:29:01PM -0700, Rob 'Commander' Pike wrote: > What's wrong ...
13 years, 10 months ago (2011-09-13 23:39:16 UTC) #18
r
Hello golang-dev@googlegroups.com, gri@golang.org, rsc@golang.org, r@google.com, cw@f00f.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 10 months ago (2011-09-13 23:40:10 UTC) #19
r2
On Sep 13, 2011, at 4:39 PM, Chris Wedgwood wrote: > On Tue, Sep 13, ...
13 years, 10 months ago (2011-09-13 23:40:51 UTC) #20
rsc
var crossdev bool var mpdev uint64 filepath.Walk(root, func(path string, d *os.FileInfo, err os.Error) os.Error { ...
13 years, 10 months ago (2011-09-13 23:41:37 UTC) #21
cw
> var crossdev bool > var mpdev uint64 > > filepath.Walk(root, func(path string, d *os.FileInfo, ...
13 years, 10 months ago (2011-09-13 23:44:00 UTC) #22
rsc
If it helps, you can always define your type and use filepath.Walk(dir, func(path, d *os.FileInfo, ...
13 years, 10 months ago (2011-09-13 23:52:28 UTC) #23
niemeyer
That's a very nice API Rob, thank you. As a minor suggestion, it'd feel nicer ...
13 years, 10 months ago (2011-09-14 00:15:38 UTC) #24
r
Hello golang-dev@googlegroups.com, gri@golang.org, rsc@golang.org, r@google.com, cw@f00f.org, n13m3y3r@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 10 months ago (2011-09-14 00:24:34 UTC) #25
gri
LGTM http://codereview.appspot.com/5014043/diff/15006/src/pkg/path/filepath/path.go File src/pkg/path/filepath/path.go (right): http://codereview.appspot.com/5014043/diff/15006/src/pkg/path/filepath/path.go#newcode267 src/pkg/path/filepath/path.go:267: // visited by Walk. If there is a ...
13 years, 10 months ago (2011-09-14 00:46:38 UTC) #26
r
*** Submitted as http://code.google.com/p/go/source/detail?r=15a61cdfd2db *** path/filepath: new signature for Walk This one uses a closure ...
13 years, 10 months ago (2011-09-14 00:48:03 UTC) #27
rog
the docs don't seem to mention that directory entries are walked in alphabetical order. perhaps ...
13 years, 10 months ago (2011-09-14 08:16:10 UTC) #28
cw
> the docs don't seem to mention that directory entries are walked > in alphabetical ...
13 years, 10 months ago (2011-09-14 17:14:27 UTC) #29
r2
On Wed, Sep 14, 2011 at 10:14 AM, Chris Wedgwood <cw@f00f.org> wrote: >> the docs ...
13 years, 10 months ago (2011-09-14 17:23:06 UTC) #30
cw
On Wed, Sep 14, 2011 at 10:23:03AM -0700, Rob 'Commander' Pike wrote: > i admit ...
13 years, 10 months ago (2011-09-14 17:25:54 UTC) #31
r2
I have read the code. My question was not about the implementation but the reason ...
13 years, 10 months ago (2011-09-14 17:28:04 UTC) #32
rsc
I think we should just document that Walk sorts and be done with it. It ...
13 years, 10 months ago (2011-09-14 17:29:45 UTC) #33
cw
> I have read the code. My question was not about the implementation but > ...
13 years, 10 months ago (2011-09-14 17:31:34 UTC) #34
cw
> If people are processing such enormous > directories that sorting is prohibitive, > they ...
13 years, 10 months ago (2011-09-14 17:32:30 UTC) #35
r2
On Wed, Sep 14, 2011 at 10:32 AM, Chris Wedgwood <cw@f00f.org> wrote: >> If people ...
13 years, 10 months ago (2011-09-14 17:33:10 UTC) #36
borman
Seems to me you should be able to tell Walk if you want the directories ...
13 years, 10 months ago (2011-09-14 17:51:12 UTC) #37
r2
13 years, 10 months ago (2011-09-14 18:05:40 UTC) #38
There's always a tradeoff between feature-richness and smoothness in
interface design.

I like the current tradeoff.

-rob
Sign in to reply to this message.

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