Google's internal Go style guide

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/golang

Our great sponsors
  • SonarLint - Clean code begins in your IDE with SonarLint
  • InfluxDB - Access the most powerful time series database as a service
  • SaaSHub - Software Alternatives and Reviews
  • go

    The Go programming language

    I think generics tip the scale. One neat thing about not trying too hard to make to make a super-awesome set that takes advantage of all the things sets can do and just straight-up settle for a map[T]struct{} is that you can swap out any existing map[T]struct{} in your code for the new set type, and nearly transparently drop in the new stuff with sensible implementations. (Note for those who may not realize it, it is perfectly valid go to take a library that implements a generic map[T]struct{} and drop it into your map[string]struct{} with no further modifications; you are not obligated to "keep" the genericness.) A generic library that tries to wrap a map[T]bool, from the point of view of a generic library, is making a much bigger assumption about those bools. Your local code is entitled to make such assumptions and deliberately choose a reduced subset of the types it is invoking, but a library author is much less entitled to assume that and ought to be a lot more nervous about what that true versus false means because their assumptions are being imposed on the user of the library.

  • gomock

    GoMock is a mocking framework for the Go programming language. (by golang)

    Where we do use mocks, we primarily use GoMock.

  • SonarLint

    Clean code begins in your IDE with SonarLint. Up your coding game and discover issues early. SonarLint is a free plugin that helps you find & fix bugs and security issues from the moment you start writing code. Install from your favorite IDE marketplace today.

  • Bazel

    a fast, scalable, multi-language and extensible build system

    This will be controversial, but I do think the considerations for good package design are agnostic to build system: raw go toolchain or Bazel. The build system can affect package layout, but you can still design a good model with either.

  • wire

    Compile-time Dependency Injection for Go

    For larger object graphs do you roll everything by hand or encourage something like https://github.com/google/wire

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts