"cannot use X as type Y in assignment" error occurs because Go is a statically typed language and you are trying to assign a value of one type to a variable of an incompatible type. You must explicitly convert the value to the target type using a type assertion or a type conversion.
// If X is an interface and Y is a concrete type:
var y Y = x.(Y)
// If X and Y are basic types (e.g., int to float64):
var y Y = Y(x)