Closed mvo5 closed 5 years ago
With the introduction of the diff code in PR#100 a subtle bug was introduced. When doing something like:
err := c.Check(nil, Equals, osutil.ErrAlreadyLocked)
the error is the very misleading:
flock_test.go:149: c.Assert(nil, Equals, osutil.ErrAlreadyLocked) ... obtained = nil ... expected *errors.errorString = &errors.errorString{s:"cannot acquire lock, already locked"} ("cannot acquire lock, already locked") ... runtime error: invalid memory address or nil pointer dereference
This is because the diffworth() code does not properly check for nil. This PR fixes this and adds some tests around the nil handling in Equals.
With the introduction of the diff code in PR#100 a subtle bug was introduced. When doing something like:
the error is the very misleading:
This is because the diffworth() code does not properly check for nil. This PR fixes this and adds some tests around the nil handling in Equals.