package pid import ( "testing" "time" ) func TestPidLock_Lock(t *testing.T) { name := "./.pid" lock := NewPidLock(name) err := lock.Lock() defer func(lock *PidLock) { lock.UnLock() }(lock) if err != nil { t.Fatal(t) } time.Sleep(10 * time.Second) }