Replace
var c float64 = (-2.0 * math.Pi * k) / N
by
var c float64 = (-2.0 * math.Pi * float64(k)) / float64(N)
To quote spec :
Conversions are required when different numeric types are mixed into expressions or assignments. For example, int32 and int do not match the type, even if they can be the same size for a particular architecture.
Go uses static typing and does not automatically convert numeric types. The reason is probably to avoid some errors. For example, what value and what type should float64(2.5) * int(2) give? Should the result be int(5) ? int(4) ? float64(5.0) ? Go is not a problem. The Go Go FAQ has more to say about this.
@jnml indicates that in this case is enough:
var c float64 = -2 * math.Pi / float64(N)
source share