New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net/http: perhaps merge IsDir checks in fs.go #33385
Comments
In the first example, the check may seem useless but it’s explicit, which can be more clear to people when reading the code. I don’t think opening a change for that is necessary. The second example seems more appropriate to fix since it’s checking |
@andybons , can I work on this? |
@andybons I will give some time this weekend to submit a patch if a PR is welcome. |
@bharaththiruveedula @spacewander I will leave it up to both of you to determine who will author a patch. Keep in mind we're still in the 1.13 freeze right now so the changes won't actually be merged until the 1.14 tree opens. |
@andybons |
Change https://golang.org/cl/188677 mentions this issue: |
@spacewander please follow first come first serve and wait if no activity is there. Please don't override anyone here. Anyways it's fine. Hope we follow some rules in the community! |
@bharaththiruveedula as @spacewander filed the issue, it’s fair for them to contribute the change to fix it. There are plenty of other issues to help with. |
oh is it.. my mistake...apologies @spacewander |
Fixes golang#33385 Change-Id: I497ccd868d408a9c5648c72aa5ce41221368daf4 GitHub-Last-Rev: 3bf4838 GitHub-Pull-Request: golang#33423 Reviewed-on: https://go-review.googlesource.com/c/go/+/188677 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you see instead?
In
net/http/tranfers.go
: https://github.com/golang/go/blob/master/src/net/http/transfer.go#L254Since we have already checked
t.ContentLength > 0
andt.ContentLength < 0
, thet.ContentLength == 0
in the fourth if branch looks useless.In
net/http/fs.go
: https://github.com/golang/go/blob/master/src/net/http/fs.go#L586Maybe we could merge this two
if d.IsDir() {
into one.Please correct me if I am wrong.
The text was updated successfully, but these errors were encountered: