Naming conventions for Go packages

Let's say you come across a package named server. Is that a good name, as per the preceding suggestion? Well, obviouslywe can guess that it's some kind of server, but what kind is that? Is it an HTTP server, for instance, a TCP-based server implementing a text-based wire protocol, or maybe a UDP-based server for an online game? Some of you may argue that the package might export a type or function that alludes to the package's purpose (for example, NewHTTPServer). That certainly disambiguates things, but it also introduces a bit of repetition: in this particular case, the server literal is present in both the package name and a function exposed by it. As we will see in the Improving code quality metrics ...

Get Hands-On Software Engineering with Golang now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.