cmd/cloner: unify switch cases
And in the process, fix a bug:
The fmt formatting was being applied by writef,
not fmt.Sprintf, thus emitting a MISSING string.
And there's no guarantee that fmt will be imported
in the generated code.
@@ -211,10 +211,8 @@ func gen(buf *bytes.Buffer, imports map[string]struct{}, typ *types.Named, thisP
writef("\t}")
}
writef("}")
- case *types.Struct:
- writef(`panic("TODO struct %s")`, fname)
default:
- writef(`panic(fmt.Sprintf("TODO: %T", ft))`)
+ writef(`panic("TODO: %s (%T)")`, fname, ft)
}
}
writef("return dst")
