Go

Go

Made by DeepSource

Poorly chosen identifier SCC-ST1003

Style
Minor

Identifiers, such as variable and package names, follow certain rules.

Package Naming Conventions

  • It's helpful if everyone using the package can use the same name to refer to its contents, which implies that the package name should be good: short, concise, evocative.
  • By convention, packages are given lower case, single-word names; there should be no need for underscores or mixedCaps.

MixedCaps

The convention in Go is to use MixedCaps or mixedCaps rather than underscores to write multiword names.

Initialisms

Words in names that are initialisms or acronyms (e.g. "URL" or "NATO") have a consistent case.

For example : - "URL" should appear as "URL" or "url" (as in "urlPony", or "URLPony"), never as "Url". - ServeHTTP should be used and not ServeHttp. - For identifiers with multiple initialized "words", For example use "xmlHTTPRequest" or "XMLHTTPRequest".

Variable Names

Variable names in Go should be short rather than long. This is especially true for local variables with limited scope. Prefer c to lineCount. Prefer i to sliceIndex.

The basic rule: - The further from its declaration that a name is used, the more descriptive the name must be. - For a method receiver, one or two letters is sufficient. Common variables such as loop indices and readers can be a single letter (i, r). - More unusual things and global variables need more descriptive names.