Golang
Tracing has already been done — what exactly did you do?
Task 1: What will the code with slices output? (append, capacity, shared underlying array)
Do you want to grow as a technical specialist or are you considering moving into management?
Did you participate in onboarding new employees, and did you help junior colleagues?
What is the select construct used for?
What happens after entering google.com in the browser and pressing Enter? Describe the entire process and participants.
// Fix the code so that requests are concurrent and the response code is displayed // and in case of error - log it and continue processing package main import "net/http" var addrs = []string{"[link] "[link] "[link] "[link] "[link] "[link] "[link] func main() { wg := sync.WaitGroup{} data := make(map[string]bool) for _, url := range addrs { wg.Add(1) if !data[url]{ data[url] = true go func(url string){ defer wg.Done() resp, err := http.Get(url) if err != nil { log.err return } log.info }(url) } } wg.Wait() }
Why did you decide to change your job? What are you looking for?
What to say to the interviewer (if asked) "I would use a worker pool with a fixed number of workers, a channel for tasks, and a sync.WaitGroup. The workers will execute requests, and timeout and cancellation will be controlled through the context. I will collect the results in a slice, protected by a mutex (or through a separate channel)."} Now it's your turn Write the code in this chat. I will review and give feedback. If you don't know where to start – ask for a hint. Good luck!
Suggest how to formalize this in REST style — how to rename all these methods?
Do you have experience working with Docker? Have you written Dockerfiles yourself?
How to solve the race condition problem when adding products to the same cart from different goroutines?
Why did you enter the labor market / why are you looking for a new job?
What are geofiltered indexes used for?
What is the difference between HTTP and HTTPS?
What other synchronization primitives do you know?
type TTLCache interface { Set(k string, v any, ttl time.Duration) Get(k string) (any, bool) Del(k string) bool } // Should not leak memory // get should not return expired // Implementation
Tell me more about your recent projects: technologies, your responsibilities, main tasks.
```go type User struct { ID int Name string } var ( dbHits int ) func getUserInfoFromDB(id int) User { time.Sleep(100 * time.Millisecond) dbHits++ return User{ID: id, Name: fmt.Sprintf("User-%d", id), } } func main() { var wg sync.WaitGroup for i := 0; i < 5; i++ { wg.Add(1) go func(i int) { defer wg.Done() fmt.Println(getUserInfoFromDB(i)) }(42) } wg.Wait() fmt.Println("DB hits:", dbHits) } ``` ```go func main() { var wg sync.WaitGroup j := 12345 for i := 0; i < 5000; i++ { wg.Add(1) go func(i int) { defer wg.Done() once.Do(func() { user = getUserInfoFromDB(42) }) fmt.Println(user) }(j) } wg.Wait() fmt.Println("DB hits:", dbHits) } ``` (There is no explicit question text, but the code suggests a task related to concurrency, synchronization, and minimizing database hits by using sync.Once or similar techniques.)
What are TCP and UDP, and what is the difference?