What is a channel?
A channel lets goroutines exchange typed values and synchronize execution.
The question library
Explore practical questions, clear explanations, and code examples across developer technologies.
Showing 1837–1848 of 3610 questions
A channel lets goroutines exchange typed values and synchronize execution.
An unbuffered channel synchronizes sender and receiver; a buffered channel can temporarily store values.
select waits until one of its channel operations can proceed.
WaitGroup waits for a collection of goroutines to finish.
Each value has an owner; when the owner goes out of scope the value is dropped unless ownership has moved or been borrowed.
Rust bindings are immutable by default; mut allows reassignment or mutation through that binding.
String owns a growable UTF-8 buffer; &str is a borrowed string slice.
Borrowing accesses a value through a reference without taking ownership, under compile-time aliasing rules.
&T is an immutable reference; &mut T permits mutation and requires exclusive access during the borrow.
Give each goroutine a clear lifetime and an exit path.
Pass context as the first parameter to operations that may block and always call derived cancel functions.
A mutex is often simplest for protecting shared in-memory state; channels suit communication and work transfer.