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.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
josh/immutable-views
Josh Bleecher Snyder 3 years ago committed by Josh Bleecher Snyder
parent d8a8f70000
commit d5a0a4297e

@ -211,10 +211,8 @@ func gen(buf *bytes.Buffer, imports map[string]struct{}, typ *types.Named, thisP
writef("\t}") writef("\t}")
} }
writef("}") writef("}")
case *types.Struct:
writef(`panic("TODO struct %s")`, fname)
default: default:
writef(`panic(fmt.Sprintf("TODO: %T", ft))`) writef(`panic("TODO: %s (%T)")`, fname, ft)
} }
} }
writef("return dst") writef("return dst")

Loading…
Cancel
Save