If it helps someone else, :
The problem was it was using go version 1.20
Needed to change go.mod to use
go 1.22.3


On Monday, June 3, 2024 at 1:20:20 PM UTC-4 rogerjd wrote:

> Your code works both in the playground and on my local machine.
> I need to figure what I did wrong originally.
> Thank you for helping,
> Roger
>
> On Monday, June 3, 2024 at 3:26:22 AM UTC-4 p...@morth.org wrote:
>
>> Hi,
>>
>> It works on the playground at least, https://go.dev/play/p/YZbgmezjSIV
>> Are you sure your server is listening on port 80? That's fairly uncommon 
>> for service code and usually requires extra permissions.
>> If it's listening on another port, you'll have to specify that in the 
>> browser as well (see line 27 in the link above).
>>
>> Regards,
>> Per Johansson
>>
>> On Sunday, June 2, 2024 at 11:26:36 PM UTC+2 rogerjd wrote:
>>
>>> Routing Enhancements for Go 1.22
>>>
>>> I have this in the init func for main 
>>>     http.HandleFunc("GET /posts", handlePost2)
>>>
>>> Yet, in the browser, when http://127.0.0.1/posts is entered, it returns
>>> 404 page not found.
>>>
>>> Am I doing something wrong? Maybe the problem lies elsewhere?
>>> Thank you,
>>> Roger
>>>
>>> func handlePost2(w http.ResponseWriter, r *http.Request) {
>>>     fmt.Fprint(w, "GET test handlePost2")
>>> }
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/afed0533-0e52-4138-a848-ef4deb8af422n%40googlegroups.com.

Reply via email to