I have a type like this
type Transformer func(raw string) (*interface{}, error)
I need a function for boolean
var TransformBoolean Transformer = func(raw string) (*interface{}, error) {
var value bool
if raw == "true" {
value = true
} else if raw == "false" {
value = false
} else {
return nil, Error{"Invalid"}
}
return &value, nil // <-- Here's the error
}
The function return type is interface{} because it can return ints, booleans, floats, etc. But, the compiler doesn't let me return a *boolean as a *interface{}