Closed GoogleCodeExporter closed 8 years ago
I think I found two issues introduced by fixing issue #13:
1. client ReadDir should treat os.EOF as indication of stream termination, not erro
2. subtle "err != nil" always true when an err variable of type os.Error gets assigned with a *Error: even if the *Error value is nil, the os.Error value is never nil
patch attached
PS: about point 2:
I'm new to go and I find it weird but, yes, it makes sense. Consider:
func main() {
var x *int = nil
var t interface{} = x
fmt.Printf("%t\n", t == nil) // prints "false"
}
This is because an interface value has to have a "zero" value, and it's nil. If
you assign a pointer which implements that interface, that pointer can point
somewhere or be nil, it doesn't matter, it's a valid pointer; and if you assign
this pointer to the interface value, that interface value now has a value which
is not nil.
Original comment by mmikuli...@gmail.com
on 6 Jun 2011 at 8:51
Attachments:
(for educational purposes I expanded a little bit the causes of this issue
here: http://www.coldcode.net/2011/06/golang-interface-is-not-nil-even-if.html)
Original comment by mmikuli...@gmail.com
on 6 Jun 2011 at 9:13
Fixed
Original comment by lion...@gmail.com
on 13 Jun 2011 at 3:46
Original issue reported on code.google.com by
mmikuli...@gmail.com
on 6 Jun 2011 at 4:24