News for hackers. Stuff that matters.
Re:Go Web Examples by ilozinski on Friday February 10, 2017 @01:22AM (#13613623)
Gorilla mux is way overrated and overused. I'm not sure why it's the first choice for so many people. There are much better alternatives such as https://github.com/julienschmidt/httprouter or https://github.com/gin-gonic/gin.
Re:Go Web Examples by Arcaire on Friday February 10, 2017 @01:23AM (#13613628)
Care to explain why it's overused in comparison to other toolkits/frameworks/libraries? Taking in to account, of course, the target use-cases.
Re:Go Web Examples by mmgutz on Friday February 10, 2017 @11:28AM (#13616559)
Along the same tone, httprouter doesn't allow defining these routes simultaneously

    users/:id
    users/watching
Was kind of surprised as we have many routes like that. Like gorilla/mux, I think it was just first (trie-based mux). Isn't gin based on httprouter?

There are even better muxes now. `pressly/chi` is used by heavy hitters in production and takes advantage of Go 1.7 HTTP context. `labstack/echo` is another highly recommended by others but I don't like the non-idiomatic echo.Context in handler signatures.

Back on topic, I hope the go web examples only imports built-in packages. The gorilla/mux example could easily be written to use built-in packages.

Re:Go Web Examples by AsyncAwait on Friday February 10, 2017 @05:01AM (#13614366)
Part of the reason is that gorilla/mux uses identical API to the standard library.
Re:Go Web Examples by sethammons on Friday February 10, 2017 @07:58AM (#13615046)
I avoid httprouter because it doesn't adhere to the standard library interface for http handlers. I've not used gin, but it looks to also not follow the standard library interface here. Also, it does not appear to make use of newer developments in Go such as the context package (it imports the x/pkg version but does nothing with it I think).
Re:Go Web Examples by joncalhoun on Friday February 10, 2017 @11:09AM (#13616350)
I believe gorilla mux came out years before the others, so it's not really shocking that it is used more. I personally have never had any issues with it but to each there own.
Re:Go Web Examples by iamgopal on Friday February 10, 2017 @06:01AM (#13614549)
Contradiction does not exist. :)