MCPcopy Index your code
hub / github.com/koding/kite / Square

Function Square

examples/math-register/math-register.go:53–67  ·  view source on GitHub ↗
(r *kite.Request)

Source from the content-addressed store, hash-verified

51}
52
53func Square(r *kite.Request) (interface{}, error) {
54 // Unmarshal method arguments
55 a := r.Args.One().MustFloat64()
56
57 result := a * a
58
59 fmt.Printf("Call received, sending result %.0f back\n", result)
60
61 // Print a log on remote Kite.
62 // This message will be printed on client's console.
63 r.Client.Go("kite.log", fmt.Sprintf("Message from %s: \"You have requested square of %.0f\"", r.LocalKite.Kite().Name, a))
64
65 // You can return anything as result, as long as it is JSON marshalable.
66 return result, nil
67}

Callers

nothing calls this directly

Calls 4

MustFloat64Method · 0.80
OneMethod · 0.80
GoMethod · 0.80
KiteMethod · 0.45

Tested by

no test coverage detected