type FloatValueImpl struct {
get func() float32
set func(float32)
}
func (f FloatValueImpl) Get() float32 { return f.get() }
func (f FloatValueImpl) Set(g float32) { f.set(g) }
and then use
fv := FloatValue(FloatValueImpl{func..., func...})
but in the case you showed it would be easier to do
type floatValue float32
func (f *floatValue) Get() float32 { return *f }
func (f *floatValue) Set(g float32) { *f = g }
var value floatValue
fv := FloatValue(value)
func main() {
x := []int{5, 1, 4, 2, 3}
sort.Sort(ClosureSort(func() int { return (len(x)) },
func(i, j int) bool { return x[i] < x[j] },
func(i, j int) { x[i], x[j] = x[j], x[i] }))
fmt.Print(x)
}