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. send's parameter reaches a sink. A direct call passes a
4// sentence, but a call through a function value passes an error's text and
5// escapes the argument checks.
6
7func send(w int, msg string) {
8 jsonError(w, 400, msg)
9}
10
11func direct(w int) {
12 send(w, "invalid region")
13}
14
15func indirect(w int, err error) {
16 f := send
17 f(w, err.Error())
18}
19
20type server struct{}
21
22func (s server) report(w int, msg string) {
23 jsonError(w, 400, msg)
24}
25
26func methodValue(w int, s server, err error) {
27 g := s.report
28 g(w, err.Error())
29}
30