A colleague wrote a concurrent DNS cache. It seems to work locally but behaves unpredictably in production — sometimes it resolves all domains, sometimes only a few, and occasionally it crashes entirely.
Your job is to find and fix all concurrency bugs.
Run the program:
go run .Run the tests:
go test -race -count=1 ./...Check for common issues:
go vet ./...- Do not change the test file
- All tests must pass with
-race go vetmust report no issues- The program must always resolve all domains
- There are 4 distinct issues in
main.go - The race detector and
go vetwill help you find them