q.TODO and q.Unreachable¶
Panic with a call-site-prefixed message. Rust's todo!() / unreachable!(). Statement-only.
Signatures¶
Both variadic — the message is optional.
What q.TODO does¶
rewrites to (say, parser.go line 42):
Without a message:
q.Unreachable¶
Same shape, different message prefix. Use where the code path shouldn't happen even given arbitrary inputs — e.g. the default branch of an exhaustive switch:
switch tag {
case "a", "b", "c":
return handle(tag)
default:
q.Unreachable("tag was %q", tag) // oh no, use %v-style formatting?
}
(No, the current q.Unreachable(msg) takes a string, not a format string. Use fmt.Sprintf on the caller side for formatted messages.)
Statement forms¶
Stmt-only — both return nothing.
See also¶
- q.Require — bubble (not panic) when a runtime precondition fails.