Hi all,
I've got a function I am writing a test for with the signature func EnsureMinMax(input []interface{}) [2]float32 The function takes in some crazy data and tries to type it. Here is a simplified playground example: https://play.golang.com/p/Tf4keVEkmBn
I am wondering if the solution in that link is the simplest one? I have to write a number of tests for this function, and I am trying to limit the logic in the test.
(the solution being)
fs := []float64{0.0, 0.0}
islice := make([]interface{}, len(fs))
for i, f := range fs {
islice[i] = f
}
I get why test := make([2]interface{}, 1) could never work, but is there something simple like that I don't know about?
Thanks for any help.