carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package fixture
2
3// Not compiled. The literal writes a recorded sentence, but a later
4// assignment takes one result of a multi-value expression into the same
5// field. The gate cannot prove that write, so the read is a violation.
6
7type refusal struct{ Reason string }
8
9func detail(err error) (string, error) {
10 return err.Error(), nil
11}
12
13func multi(w int, err error) {
14 box := refusal{Reason: "invalid region"}
15 box.Reason, _ = detail(err)
16 jsonError(w, 400, box.Reason)
17}
18
19func commaOK(w int, names map[string]string, k string) {
20 box := refusal{Reason: "invalid region"}
21 var ok bool
22 box.Reason, ok = names[k]
23 _ = ok
24 jsonError(w, 400, box.Reason)
25}
26