import "sync" var lock sync.Mutex func someFunction() { lock.Lock() defer lock.Unlock() // code that must be synchronized }In this example, we define a global `lock` variable of type `sync.Mutex`. Whenever we need to synchronize access to a shared resource, we call `lock.Lock()` to take the lock, and `defer lock.Unlock()` to release the lock. This ensures that only one goroutine can access the shared resource at a time. Package Library: "sync".