Explain the purpose and how the sync.Once structure works in Go.
Golang
Tell me about your career path at Wildberries: what grade did you start at, and how did you grow?
Are there mechanisms that help eliminate collisions in programming?
Where is memory allocated for a slice — on the stack or on the heap?
What tools are available in Go for detecting data races?
If losing multiple analytics events is acceptable — how can you do without the outbox pattern?
How do you rate your level: junior, mid, senior?
How does the process of handling an HTTP request work in a browser, and what happens on the client and server sides?
There is a local limit for a specific filter and a global HH limit of 16,000 — how to architect this?
Why is mutex not suitable for distributed lock?
Question about a slow service For example, when creating an order. There is a request to the service and a response, and between these two actions, we log the products ordered (for example, to count the popularity of products). The analytics service periodically works slowly or times out, and we fail to respond, losing orders. What to do to stop losing orders and money accordingly? Come up with a way to parallelize the order and analytics.
What will happen in the end to the length of the array when appending concurrently from 1000 goroutines?
What are the key differences between a binary tree and a balanced tree in data structures?
Does the standard map provide thread safety when multiple threads operate simultaneously?
How often have you had to delve into databases — writing and optimizing queries?
If all values fall into one bucket and overflow buckets accumulate, what will happen during same-size grow (repacking without increasing size)?
Why are proposals currently open that indicate dissatisfaction with the current situation?
What can be done to avoid map evacuation in a high-load service?
Given the "orders" table: +----+---------+---------------------+-------------+ | id | user_id | created_at | price_total | +----+---------+---------------------+-------------+ | 1 | 111 | [phone]:00:00 | 2000 | | 2 | 222 | [phone]:00:00 | 1000 | | 3 | 111 | [phone]:00:00 | 2000 | | 4 | 222 | [phone]:00:00 | 5000 | | 5 | 333 | [phone]:00:00 | 1000 | +----+---------+---------------------+-------------+ Write an SQL query that returns the number of orders for each user with price_total greater than or equal to 1000, sorted in descending order by order count: +---------+-------------+ | user_id | order_count | +---------+-------------+ | 111 | 2 | | 222 | 1 | | 333 | 1 | +---------+-------------+
What will the program output? Why? func main() { timeStart := time.Now() _, _ = <-worker(), <-worker() println(int(time.Since(timeStart).Seconds())) } func worker() chan int { ch := make(chan int) go func() { time.Sleep(3 * time.Second) ch <- 1 }() return ch }