Go

Go

Made by DeepSource
A switch's default case should be the first or last case SCC-ST1015
Style
Minor

For better readability, always place default of switch as first or last case.

Incorrectly formatted error string SCC-ST1005
Style
Minor

Error strings follow a set of guidelines to ensure uniformity and good composability. Quoting Go Code Review Comments:

A function's error value should be its last return value SCC-ST1008
Style
Minor

Per convention, a function's error value should be its last return value.

Hex literal with mixed case letters CRT-A0005
Style
Minor
Autofix

It is not recommended to use Hex literal with mixed casing.

Types of function parameters can be combined CRT-A0017
Style
Minor
Autofix

If parameters of the same type lie consecutively, mention their type once at the end of the last parameter.

Redundant error checking RVV-B0005
Style
Major
Autofix

Some simple error checking patterns can be reduced to just a single return statement returning a variable of type Error.

Use consistent method receiver names SCC-ST1016
Style
Minor

As our codebase grows, eventually we'll need to refactor some of it. For example, consider moving pieces of code between levels abstractions or

Poorly chosen name for error variable SCC-ST1012
Style
Minor

The error variable name should be chosen carefully to convey the meaning of the error. It is recommended to use names like errFoo, ErrSomethingBad, ErrKindFoo or BazError for error variables that are part of an API. Examples:

Poorly chosen name for variable of type time.Duration SCC-ST1011
Style
Minor

time.Duration values represent an amount of time, which is represented as a count of nanoseconds. An expression like 5 * time.Microsecond yields the value 5000. It is therefore not appropriate to suffix a variable of type time.Duration with any time unit, such as Msec or Milli.

Incorrect or missing package comment SCC-ST1000
Style
Minor

Package comments, like all comments to be presented by godoc, must appear adjacent to the package clause, with no blank line.

Poorly chosen identifier SCC-ST1003
Style
Minor

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

Non-idiomatic comment formatting GO-C4004
Style
Minor

Comments should have a space between the // and the comment text

deferred function literal can be simplified GO-C4005
Style
Major

It is recommended to remove the wrapping function literal if it has a single function call. This makes the code succinct.

Regular expression can be simplified GO-C4007
Style
Minor

Simplified regular expressions make the intent clear while being easier to refactor.

Function returns too many results GO-C4008
Style
Minor

It is recommended to use a struct when a function returns too many results.

Method declaration preceding the type definition GO-C4009
Style
Minor

It is idiomatic for the type definition to be before the method declarations.

TODO comments written without any detail or assignee GO-C4010
Style
Minor

TODO comments should be accompanied by details or assignees and not left empty so that they can be addressed later, and when it is referenced in the future, it will help define the scope of the work.

Simplify Before or After call of time.Time GO-C4011
Style
Minor

Some calls of Before or After for time.Time can be simplified and it is recommended as well because the code will look simple and idiomatic.

Redundant type in variable declaration GO-C5001
Style
Major

Go infers the types of the variables if the type is not written explicitly. It is recommended to remove the type in the declaration for succinctness.