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 one maker of server text, writing a literal or a named
4// constant instead of a value read from the decoded response (fix round 3 of
5// Plan 6 Task 1a, hole 2). Only the last return is legitimate.
6
7type serverText struct{ spoken string }
8
9type mover struct{ httpc client }
10
11const unreviewed = "unreviewed constant"
12
13func saySpoken(out int, t serverText) {}
14
15func (m *mover) roundTrip(kind int) serverText {
16 res, _ := m.httpc.Do(nil)
17 var e struct{ Error string }
18 _ = json.NewDecoder(res.Body).Decode(&e)
19 switch kind {
20 case 0:
21 return serverText{spoken: "unreviewed literal in the maker"}
22 case 1:
23 return serverText{spoken: unreviewed}
24 case 2:
25 const local = "unreviewed local constant"
26 return serverText{local}
27 }
28 return serverText{spoken: e.Error}
29}
30