Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Channels: Communication Bet | Go Programming Bootcamp lesson | BraveProgrammer
  1. Courses
  2. /
  3. Go Programming Bootcamp

Lesson 14 of 60

·Go

Channels: Communication Between Goroutines

20 minutes

Course progress23%

Channels

This lesson explains the main concept clearly with beginner-friendly examples and background so you can learn why the code works.

Channels are typed conduits that allow goroutines to communicate safely.

ch := make(chan int) // unbuffered channel

go  { ch <-  }() 
val := <-ch 
fmt.Println(val) 
func
()
42
// send
// receive
// 42

Buffered channels

buf := make(chan string, 3) // capacity 3
buf <- "a"
buf <- "b"
fmt.Println(<-buf) // a

Closing channels

close(buf)
for v := range buf { fmt.Println(v) }

Select statement (multiplexing)

select {
case v := <-ch1:
    fmt.Println("from ch1", v)
case ch2 <- 99:
    fmt.Println("sent to ch2")
default:
    fmt.Println("no activity")
}

Info

Reading from a closed channel yields the zero value without panic. Sending on a closed channel panics.
Make it stickPractice what you've learned1 quiz · 3 practical tests · Optional activities from Go Programming BootcampBrowse activities
Previous lessonConcurrency Primer: GoroutinesContinue to lesson 15Concurrency Patterns: Worker PoolsBack to Go Programming Bootcamp curriculum