Skip to content

Golang style guide

Roland Bracewell Shoemaker edited this page Aug 23, 2016 · 2 revisions

The code base generally follows the rules outlined in Effective Go as well as a few other guidelines that are specific to Boulder internals.

metrics.Scope usage

  • If a service needs to report metrics it should use a metrics.Scope. If a service has child services which also require their own specific metrics.Scope they should create a new one in their constructor from the parent using scope.NewScope(...) instead of blindly using the scope passed in by the caller.

net/http usage

  • If a request or response body needs to be read from a io.LimitedReader should be used to avoid loading excessive data into memory.