-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: ServeMux behaves inconsistently across operating systems #66288
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
Labels
FrozenDueToAge
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Comments
please show your go.mod files for both environments. |
Here's my go.mod in my Windows 10 machine.
I copied the code straight into Go playground so no go.mod file there. |
Ah gg the go directive. Didn't know how it worked. Now I know. Thanks for your time. |
This was referenced Aug 11, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
FrozenDueToAge
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Go version
go version go1.22.1 windows/amd64
Output of
go env
in your module/workspace:What did you do?
I decided to try the new
http.ServeMux
but it seems the pattern matching behaves inconsistently across operating systems. Basically my route never gets matched and a 404 gets returned, even though the request has the exact same method and path as the one configured for the route.I am developing on a Windows 10 machine but when I try the same code on a Linux machine I get a different result. I don't have a Linux machine at hand so I ran the code on the Go playground, which I'm assuming is running on Linux servers (a quick loop of
os.Environ()
in Go playground also suggests this).Here's a small example to demonstrate the problem.
What did you see happen?
I get the following output.
$ pattern: ""
I want to emphasize again that this seems to happen only on Windows.
What did you expect to see?
I expected the following output.
$ pattern: "GET /some/path"
I get this output only in Go playground which I'm assuming is running Linux.
The text was updated successfully, but these errors were encountered: