Which block of logic is the lock/unlock operation here, is it the write to dst, or the entire block from 100 lines to 109 lines? For timeout.go#L114, which is the same for the lock and release locks here? If it is for data writing/reading, see if you use mu sync.Mutex here, can you use rw lock?