Looking for elegant code bases written in Golang

15 points by suhasval ↗ HN
I am a Java developer with some Python experience. On my next project, I need to get hands-on with Golang quickly. So I would like to look at projects that have well-defined project structures, clean code, and tests. Also, any articles about coding style in Go would be highly appreciated.

6 comments

[ 3.3 ms ] story [ 31.6 ms ] thread
https://go.dev/learn/

That's all you need. Tour go, and go by example.

Go is far from java. There aren't 10 ways to do things, it's not object oriented, and things like build tools, dependency management, formating, and tests are all baked into the core.

It's a relatively simple language that uses structs and relies heavily on the adapter pattern and composition. You should have no problem learning it quickly. Most go projects will look the same, have similar structure, and all will use the same formatting required by the compiler.

As someone who’s written a decent amount of Go, I have seen some reasonable codebases as well as some truly horrific Gang-of-Five-inspired codebases that confused the hell out of me. I think the OP is smart for wanting to find some good examples. Golang is pretty non-prescriptive when it comes to higher-level project architecture, and some people really struggle there.
(comment deleted)
Take a look at: https://github.com/ThreeDotsLabs/wild-workouts-go-ddd-exampl...

(I’m one of the authors.)

This project shows how to apply more complex patterns popular in business applications while staying true to the Go ideas, and not copying them blindly from Java.

In the Go community, you’ll often hear people say „just keep things simple” beats all patterns and is all you need. This may be true if you write a CLI tool or a small library, but if you have a team maintaining a big application, some patterns are super helpful.