title: InvalidDefer layout: article

InvalidDefer occurs when a deferred expression is not a function call,
for example if the expression is a type conversion.

Example:
 func f(i int) int {
 	defer int32(i)
 	return i
 }