koding / kite

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

getting Error when running exp2-watch.go from examples folder #228

Open Shashwatsh opened 5 years ago

Shashwatsh commented 5 years ago

I'm getting this error when running exp2-watch.go from examples folder

# github.com/Shashwatsh/kite_example
./exp2-watch.go:25:21: undefined: kite.Event
./exp2-watch.go:30:13: k.WatchKites undefined (type *kite.Kite has no field or method WatchKites)

full code


import (
        "fmt"
        "log"
        "math/rand"
        "time"

        "github.com/koding/kite"
        "github.com/koding/kite/config"
        "github.com/koding/kite/protocol"
)

func init() {
        rand.Seed(time.Now().UnixNano())
}

func main() {
        // Create a kite
        k := kite.New("exp2", "1.0.0")
        k.Config = config.MustGet()

        //k.Register(&url.URL{Scheme: "http", Host: "localhost:3636/kite"})

        onEvent := func(e *kite.Event, err *kite.Error) {
                fmt.Printf("e %+v\n", e)
                fmt.Printf("err %+v\n", err)
        }

        _, err := k.WatchKites(protocol.KontrolQuery{
                Username:    k.Config.Username,
                Environment: k.Config.Environment,
                Name:        "math",
                // ID: "48bb002b-79f6-4a4e-6bba-a40567a08b6c",
        }, onEvent)
        if err != nil {
                log.Fatalln(err)
        }

        // This is a bad example, it's just for testing the watch functionality :)
        fmt.Println("listening to events")

        select {}
}