通过通道发送数据被卡住

I'm writing a server that uses long polling, and basically I have a go routine that runs periodically and sends a response over a channel. However the program gets stuck when it tries to send into the channel.

I've made a simple program that demonstrates the problem:

package main

import (
    "log"
    "time"
)

var resp chan string

func main() {
    go send()
    listen()
}

func listen() {
    select {
    case response := <-resp:
        log.Printf("Writing response: %s
", response)
    }
}

func send() {
    ticker := time.NewTicker(time.Duration(10000) * time.Millisecond)

    select {
    case <-ticker.C:
        // program gets stuck here
        log.Println("Sending")
        resp <- "Message"
    }
}

Does anyone see what the problem could be? Thanks

You have to make a channel first before using it

var resp = make(chan string)