short variable declaration

The := form that declares a new variable and sets its value in one step, letting Go infer the type.

In more detail

It is the form you will use most inside functions, as in pct, err := usage(200, 164). It is not allowed at package level, where you must use var. On the left side at least one name must be new, which lets err be reused.

Example

host := "db-1"

Related terms

Taught in

References