Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Bad

Good

Code Block
languagego
import (
  "fmt"
  "os"
  "go.uber.org/atomic"
  "golang.org/x/sync/errgroup"
)
Code Block
languagego
import (
  "fmt"
  "os"

  "go.uber.org/atomic"
  "golang.org/x/sync/errgroup"
)

Package Names

When creating and naming packages, choose a name that is,

  • All lower-case. No capitals or underscores.

  • Does not need to be renamed using named imports at most call sites.

  • Short and succint. Remember that the name is identified in full at every call site.

  • Not plural. For example, net/url, not net/urls.

  • Not "common", "util", "shared", or "lib". These are bad, uninformative names.

See also Package Names and Style guideline for Go refer to the separate page Organization of code into packages .

Function Names

We follow the Go community's convention of using MixedCaps for function names. An exception is made for test functions, which may contain underscores for the purpose of grouping related test cases, e.g., TestMyFunction_WhatIsBeingTested.

...