Sobes.tech

Which of the following code snippets contains an error or potential issue related to channel operations? Option 1 package main func main() { ch := make(chan int) ch <- 1 } Option 2 package main func main() { ch := make(chan int, 1) ch <- 1 } Option 3 package main func main() { ch := make(chan int, 1) ch <- 1 <-ch } Option 4 package main func main() { ch := make(chan int) close(ch) <-ch } Option 5 package main func main() { ch := make(chan int, 3) ch <- 4 }

Senior
212

Could you tell about your experience with open source projects and give examples of your contributions?

Senior
202

Is it possible to pass an arbitrary number of arguments to a function?

Junior
155

How do you deploy? What are the steps in the pipeline?

Senior
148

Does Go have dynamic typing?

Junior
145

How does Go ensure thread safety?

Junior
140

What are the ways to declare a WaitGroup? How to write a value into a channel?

Senior
133

What does the range of channels return? Is the record 'for _, c := range chs' valid?

Senior
122

How were the tests conducted in the CI/CD pipeline? What was monitored?

Senior
101

func fanin[T any](chs ...<-chan T) chan T { out := make(chan T) wg := sync.WaitGroup{} for _, ch := range chs { wg.Add(1) go func(c <-chan T) { defer wg.Done() for v := range c { out <- v } }(ch) } go func() { wg.Wait() close(out) }() return out } func main() { ch1 := make(chan int, 5) ch2 := make(chan int, 5) for i := 1; i <= 5; i++ { ch1 <- i ch2 <- i * 2 } close(ch1) close(ch2) fmt.Println(fanin(ch1, ch2)) }

Senior
90