Ask HN: Are you using Go for web development?
If you're using Go for web development, how have you found the experience?
What made you choose Go? Did you come from another language associated with web development (e.g. Python, PHP, Ruby)? Or did you pick Go as your first language for diving into web development? Have you run into any stumbling blocks?
I've just starting learning Go for web development and would be interested to hear comments and thoughts from anyone using Go for web development.
14 comments
[ 4.0 ms ] story [ 54.2 ms ] threadCons:
- More verbose than Python (returning errors and static typing make it not as succint as Python)
Pros:
- Static typing without being too ceremonius (compared to Python it's nice to have some errors catch by the type compiler that would popup in runtime. Refactoring also is nicer with a static typing safenet).
- Easy deployment (rsync the binary to the server and of you go, no more Pip and dynamic libraries bullshit)
- Low memory usage (nice to have the production backend running and see that it uses 15MB of mem where in Python it would be like 10 times more and with worse concurrence)
- Performance (somewhat minor plus for me because the bottleneck is almost always on the database)
I picked up go about two years because it seemed to be a really cool middle-of-the-road language. It wasn't great at anything but was pretty good at most things. Before, I had written a lot of PHP on the web.
No stumbling blocks after getting set up (GOPATH, getting newest version installed). It's always slow to learn something new.
My advice. Do not return dynamic content with Go. If you build a backend webservice in Go that is meant to serve complicated dynamic content (like the way it is possible to do with PHP), you will have a bad time. htmltemplates in Go are not good and you'll waste a lot of time try to live with them. It's better just to return a little bit of info that a front end js app can bootstrap the front-end with.
I never really liked dynamically-typed languages ... actually I really dislike PHP, but it was ... easy and familiar.
But after just a few days of playing with Golang it just felt right. It's a language to get shit done fast and easy ... and that's the most important thing IMHO.
And yes - I don't miss generics ... at all :>
For the last 14 months I've been working on a self-hosted server for building complex CRUD apps using drag-n-drop in the browser and building it with Go was a great decision.
I'll make sure to post it in the ShowHN section. :)
https://talks.golang.org/2016/applicative.slide#1
As well as this post on "Go Concurrency Patterns: Pipelines and cancellation"
https://blog.golang.org/pipelines
You'll get a feel for how you can use Go to quickly build and compose distributed microservices that can "time out" but still won't bring down the entire house of cards ;)
Having a single binary to deploy and 1.x compatibility have probably been the two features I like most about the language.
The community is great, and they are always very helpful. I think a great community around a language really makes or breaks a language.