News for hackers. Stuff that matters.
Re:Go by Example by tokenizerrr on Friday January 17, 2014 @09:17AM (#7075829)
This documentation is great, but one thing I tend to miss with examples like these is how to structure a project, deal with packages, etc.
Re:Go by Example by pearkes on Friday January 17, 2014 @09:36AM (#7075930)
GitHub is your friend here.

Here is a search for Go repositories with > 100 stars.[1] Every project will look different (the really big ones might be more complex then you need) but as you get deeper into the results you can find some great stuff.

[1]: https://github.com/search?l=go&q=stars%3A%3E100&s=stars&type...

Re:Go by Example by tokenizerrr on Friday January 17, 2014 @10:38AM (#7076280)
That's a great idea, I hadn't thought of that.
Re:Go by Example by motter on Friday January 17, 2014 @09:50AM (#7076001)
"How to Write Go Code" shows you this, and is a good read: http://golang.org/doc/code.html
Re:Go by Example by dclara on Friday January 17, 2014 @03:08PM (#7078111)
Thank you for your reference. I wish I could save it somewhere when I have time to go through it.

- Eggs should not be washed.

Re:Go by Example by stokes3452 on Friday January 17, 2014 @02:44PM (#7077975)
Agreed, the community does seem pretty loose on project structure--which is interesting since the language takes such strong stances on code structure.

Since your folder structure is also your package structure, with rmux[1] I tried to separate the project into dependencies, and use a package for each one. I like to also limit files to one class--but if you read through the default package files, the creators seems to go both ways.

One interesting thing that isn't mentioned often is how to handle the equivalent of #ifdef, through +build flags. This isn't the best solution, since all functions and their arguments are evaluated (even empty functions), but it does allow for the use of constants to wrap around cpu-wasteful debug-only areas/

[1]: https://github.com/forcedotcom/rmux