Original post

package main

import (


func g1(ch chan int) {
ch <- 42`


func g2(ch chan int) {
ch <- 43

func main() {

ch1 := make(chan int)
ch2 := make(chan int)

go g1(ch2)

select {
case v1 := <-ch1:
    fmt.Println("Got: ", v1)
case v2 := <-ch2:
    fmt.Println("Got: ", v2)
    fmt.Println("The default case!")

Why does when I launch this code I take default answer every time?

Probably because neither goroutine have been scheduled so far to be able to send something, try adding some minimal sleep to force a reschedule to another go routine