Methods are part of the type, not of the value. It is perfectly safe to
call methods on a nil value.
On 03.06.20 09:03, apmat...@gmail.com wrote:
Read function at net.go is like this:
func (c *conn) Read(b []byte) (int, error) {
if !c.ok() {
the ok checks that c is non nil:
func (c *conn) ok() bool { return c != nil && c.fd != nil }
how can c ever be nil ? if it would c.ok() call would crash.
--
You received this message because you are subscribed to the Google
Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to golang-nuts+unsubscr...@googlegroups.com
<mailto:golang-nuts+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/4969df86-c3ec-4b3f-916d-35a986884362%40googlegroups.com
<https://groups.google.com/d/msgid/golang-nuts/4969df86-c3ec-4b3f-916d-35a986884362%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
--
Gregor Best
b...@pferdewetten.de
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/e0049746-28c2-fb9c-922c-a7a32d86b776%40pferdewetten.de.