Use the following code to switch on pointer types:
d := &data{}
switch p := ptr.(type) {
case *float64:
// We handle this in two steps because int(*p)
// is not addressable.
// (1) Convert to int and assign to variable.
i := int(*p)
// (2) Assign address of variable to field.
d.timeout = &i
case *int:
d.timeout = p
case nil:
// Clear field when p == nil.
d.timeout = nil
default:
panic(fmt.Sprintf("unexpected type %T", p))
}