Skip to content
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: dubious code in TestServeMuxHandlerRedirects #18068

Closed
dominikh opened this issue Nov 28, 2016 · 3 comments

Comments

Projects
None yet
4 participants
@dominikh
Copy link
Member

commented Nov 28, 2016

The test TestServeMuxHandlerRedirects in net/http/serve_test.go looks dubious. The for tries > 0 loop will execute exactly once – tries starts at 1, gets decremented once at the bottom of the loop, and there is no path that would skip the decrement and execute the loop again. Similarly, the check if tries < 0 can never be true – tries will either be its initial value of 1, or the once-decremented value 0.

/cc @bradfitz

@bradfitz

This comment has been minimized.

Copy link
Member

commented Nov 28, 2016

@minux, looks like you wrote this code over three years ago in 716a409

You want to take a look?

@bradfitz bradfitz added this to the Go1.9 milestone Nov 28, 2016

@bradfitz

This comment has been minimized.

Copy link
Member

commented Nov 28, 2016

Marking Go 1.9, but Go 1.8 is fine too if somebody wants to look into it.

@gopherbot

This comment has been minimized.

Copy link

commented Nov 29, 2016

CL https://golang.org/cl/33654 mentions this issue.

@gopherbot gopherbot closed this in 406d2fa Nov 30, 2016

@golang golang locked and limited conversation to collaborators Nov 30, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.