koding / kite

Micro-service framework in Go
https://godoc.org/github.com/koding/kite
MIT License
3.26k stars 300 forks source link

Is it necessary to close the client in the sample code? #227

Open aapelismith opened 5 years ago

aapelismith commented 5 years ago

Is it necessary to close the client in the sample code?

package main

import (
    "fmt"

    "github.com/koding/kite"
)

func main() {
    k := kite.New("exp2", "1.0.0")

    // Connect to our math kite
    mathWorker := k.NewClient("http://localhost:3636/kite")
    mathWorker.Dial()
       **defer  mathWorker.Close()**

    response, _ := mathWorker.Tell("square", 4) // call "square" method with argument 4
    fmt.Println("result:", response.MustFloat64())
}