Why no http session support in golang?

Hello all,

This is more of a curiosity question; why is there no native session support in Go like their is in PHP? Does any one know why this was left out, or have any educated guesses?

Thanks!

Session needs storage, and that is not the domain of a language. PHP infamously has a configuration file, making it a language with different behaviours based on how it’s configured.

An interesting question might be why there is no interface for http.Session in the standard library; I suspect the answer is just that it’s better to be sure how to implement such an interface. In any case, for as common as sessions are, they are not mandated by the HTTP standard and you definitely can work without them. Hence, it’s probably not a good idea to have even just the interface for sessions in the standard library.

For a good session implementation, see: https://github.com/gorilla/sessions

4 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.