top | item 5799022

Tell HN: Ask Golang is my vacation project

56 points| carbocation | 12 years ago |askgolang.com

22 comments

order
[+] zura|12 years ago|reply
Can anyone recommend some high-level/architecture/design patterns books/materials about Go? (e.g. similar to SICP or Art of Prolog, or maybe GoF).
[+] dualogy|12 years ago|reply
> high-level/architecture/design patterns

Hardly. The Go philosophy is "our language is designed to not need such architecture-astronauts' high-brow fanciness". Other than that, whatever architecture/design patterns you're used to should mostly carry-over to Go.

[+] swalsh|12 years ago|reply
Vacations are for relaxing! this is how people get burned out....I like the idea though :D I've been wanting to learn go for a bit.
[+] carbocation|12 years ago|reply
> Vacations are for relaxing!

Maybe it wasn't exactly relaxing, but it has been fun!

> this is how people get burned out...

This is how I re-energize when taking a break from medicine :-)

[+] inovica|12 years ago|reply
A change is as good as a rest. Maybe coding isn't his primary 'job'? I myself started on the business side, so the evenings and weekends learning to code were great fun and I definitely didn't see them as negative
[+] kaoD|12 years ago|reply
Margins, please.
[+] salimmadjd|12 years ago|reply
Quick question about golang. In your code, go.user / user.go You have a Boolean function Guest(). Is this a common practice in Golang vs. writing it as IsGuest() ?

Thanks for sharing, BTW!

[+] carbocation|12 years ago|reply
I'm not sure if this is wholly idiomatic. I based it on the following from "Effective Go" [1]:

> There's nothing wrong with providing getters and setters yourself, and it's often appropriate to do so, but it's neither idiomatic nor necessary to put Get into the getter's name.

Since I view "is/has" as derivatives of "get", I opted to omit the "is" from Guest(). But I'm open to hearing other opinions.

There is probably plenty that is un-idiomatic all over this code and one of the reasons I put it out there is to get feedback.

1 = http://golang.org/doc/effective_go.html#Getters

[+] TylerE|12 years ago|reply
Seems redundant. A boolean function is by definition asking a yes/no question.
[+] Jabbles|12 years ago|reply
Yes, although

    return u.Id == 0
would be even more idiomatic :)
[+] bridgeyman|12 years ago|reply
Where do you host askgolang? I have been working on a go server with websockets too. It seems like websockets cause trouble with Heroku, Google App Engine, and AWS (if you use the ELB).
[+] carbocation|12 years ago|reply
This is on an instance of the smallest linode available (1024MB). It sits there with all of my other side projects.

Load average is negligible despite the HN load:

    Load average: 0.04 0.06 0.06
I'm using Postgres on the backend and am not using any caching. This is being reverse proxied by nginx (so that I can host multiple golang projects on the same server over port 80).
[+] ismarc|12 years ago|reply
I've been working with websockets on AWS for some data intensive bi-directional communication and haven't had any issues with it...However, I don't have it set up as an HTTP listener, I have it set to TCP 80 -> TCP <mylocalport>. The server architecture doesn't matter if a user drifts backend hosts if their connection drops and reestablishes (no stickiness needed). I haven't tried it under the HTTPS setting for SSL connections yet, but if there's flakiness, I know I can just terminate SSL on the ec2 instances instead of the ELB.
[+] carbocation|12 years ago|reply
Another thing to mention: I believe websockets use up file descriptors. If you are having issues with websockets despite nominal load, it's worth checking if you're exhausting your file descriptors.

I don't know about the architecture of Heroku, GAE, or AWS w/ ELB in terms of supporting the HTTP 1.1 Upgrade request to websockets. Perhaps they all use a reverse proxy that doesn't pass along the Upgrade request? Even nginx didn't support this before ~1.3.13.

[+] bockris|12 years ago|reply
It looks like the links are rendering backwards. e.g. src = text and text = src
[+] carbocation|12 years ago|reply
Thanks for the heads up! I created my markdown links backwards; fixed.
[+] mattdennewitz|12 years ago|reply
fun idea, thanks for sharing.

can you please try some variations in type size and weight? this would go a long way for legibility between questions, answers, comments, meta info like "submitted at", etc.