package main

import (
	"fmt"
	"time"
)

func main() {
	response := make(chan string, 1)

	go func() {
		time.Sleep(20 * time.Millisecond)
		response <- "response received"
	}()

	select {
	case message := <-response:
		fmt.Println(message)
	case <-time.After(100 * time.Millisecond):
		fmt.Println("timed out")
	}
}
