在go程序的后台运行的Websockets导致100%CPU使用率

I've implemented web sockets in my go program to regularly update three variables in the background while other processes are happening. Since doing this the program has begun taking up 100% of the CPU usage almost immediately and I'm unsure as to why.

Here is the code in question:

streamOneHandler := func(event *websockets.Event) {
    varOne, err = strconv.ParseFloat(event.Number, 64)
}

streamTwoHandler := func(event *websockets.Event) {
    varTwo, err = strconv.ParseFloat(event.Number, 64)
}

streamThreeHandler := func(event *websockets.Event) {
    varThree, err = strconv.ParseFloat(event.Number, 64)
}

errHandler := func(err error) {
    fmt.Println(err)
}


streamOne, err = websockets.WsEventServe("string1", streamOneHandler, errHandler )

    if err != nil {
        log.Fatal(err)
    }

streamTwo, err = websockets.WsEventServe("string2", streamTwoHandler, errHandler )

    if err != nil {
        log.Fatal(err)

streamThree, err = websockets.WsEventServe("string3", streamThreeHandler, errHandler )

    if err != nil {
        log.Fatal(err)
    }


go func() {
    <- streamOne
    <- streamTwo
    <- streamThree
}()

Any help figuring out what's causing this huge spike in CPU usage would be much appreciated.

This happens when you have an infinite loop spinning in a goroutine. It's hard to see where that's happening with the code subset you've posted. But that's the reason why.