Something I often hear new Go developers say is that they are looking for some good projects to study, learn from and contribute to. Normally I suggest reading the Go source: it’s easy to read, you can pick a part you are interested in, and is probably bound to be the best example of idiomatic Go. But this past weekend presented itself with an opportunity to find more open source Go projects that are of the highest quality.
I participated in Gopher Gala, a 48 hour-long worldwide hackathon for Go. Our team built a project called Go Report Card, and it aims to rate the quality of any open source Go project on Github. The tool uses various other Go tools: gofmt -s to judge basic formatting, go vet to check for suspicious constructs, gocyclo to measure the cyclomatic complexity of the code, and so on. It then averages these results to get the final grade.
My teammate Shawn Smith and I have been hitting all of the most popular Go repos on Github, and saving the results to a Mongo database. Right now, we have checked 276 of the most popular Go repositories on Github. In order to find the projects of highest quality, I selected the ones with at least 100 Go files, and ordered them by their rating. Here are the results:
Rank | Name | Github Repo | Go Files | Score |
---|---|---|---|---|
1 | go-github | google/go-github | 107 | 97.1% |
2 | Cockroach | cockroachdb/cockroach | 204 | 89.5% |
3 | golang/net | golang/net | 243 | 87.6% |
4 | xGo | exercism/xgo | 142 | 86.2% |
5 | Kubernetes | GoogleCloudPlatform/kubernetes | 636 | 83.6% |
6 | syncthing | syncthing/syncthing | 146 | 83.0% |
7 | Packer | mitchellh/packer | 656 | 82.8% |
8 | Drone | drone/drone | 189 | 82.5% |
9 | etcd | coreos/etcd | 211 | 82.3% |
10 | Docker | docker/docker | 881 | 81.4% |
11 | GoLearn | sjwhitworth/golearn | 111 | 80.8% |
12 | NSQ | bitly/nsq | 116 | 80.8% |
13 | GoConvey | smartystreets/goconvey | 160 | 79.5% |
14 | golang/tools | golang/tools | 452 | 79.2% |
15 | Fleet | coreos/fleet | 151 | 79.1% |
16 | LimeText | limetext/lime | 150 | 79.0% |
17 | Flynn | flynn/flynn | 229 | 78.4% |
18 | godropbox | dropbox/godropbox | 157 | 78.1% |
19 | consul | hashicorp/consul | 182 | 77.4% |
20 | terraform | hashicorp/terraform | 454 | 74.2% |
A lot of these are indeed fantastic projects. And if you are looking for a smaller project to start with, here are the highest-rated open source repos with at most 100 Go files:
Rank | Name | Github Repo | Go Files | Score |
---|---|---|---|---|
1 | httplogger | ernesto-jimenez/httplogger | 2 | 100.0% |
2 | Google Analytics Beacon Analytics | igrigorik/ga-beacon | 1 | 99.6% |
3 | s3cache | sourcegraph/s3cache | 1 | 99.4% |
4 | watchreadlisten | shawnps/watchreadlisten | 1 | 99.3% |
5 | go-loggly | segmentio/go-loggly | 1 | 99.3% |
6 | Exercism CLI | exercism/cli | 27 | 99.0% |
7 | TextQL | dinedal/textql | 1 | 98.7% |
8 | exercism/arkov | exercism/arkov | 9 | 97.2% |
9 | go-prompt | segmentio/go-prompt | 6 | 95.8% |
10 | SSCC | pblaszczyk/sscc | 14 | 94.64% |
11 | mewmew/playground | mewmew/playground | 96 | 91.9% |
12 | go-stats | segmentio/go-stats | 3 | 91.6% |
13 | localtunnel | progrium/localtunnel | 3 | 91.6% |
14 | freegeoip | fiorix/freegeoip | 9 | 91.6% |
15 | negroni | codegangsta/negroni | 11 | 90.9% |
16 | MAST | ikawaha/mast | 27 | 90.7% |
17 | martini | go-martini/martini | 16 | 90.6% |
18 | Bolt | boltdb/bolt | 42 | 90.4% |
19 | LLVM | mewlang/llvm | 21 | 90.4% |
20 | notify | rjeczalik/notify | 41 | 90.2% |
If Go Report Card is to believed, any of these projects a great place to start learning high-quality, idiomatic Go!
To see how your own open source repo measures up, you can try it out on goreportcard. For example, this is what the output looks like for our hackathon project:
Goreportcard is free and open source, you are welcome to check out the Github repo and run checks for your own repo.
Herman is a Go developer living and working in Asia. Feel free to reach out @ironzeb to continue the discussion.