Skip to content

Instantly share code, notes, and snippets.

@rafrombrc
Created February 21, 2014 19:47
Show Gist options
  • Save rafrombrc/9142016 to your computer and use it in GitHub Desktop.
Save rafrombrc/9142016 to your computer and use it in GitHub Desktop.
When nil != nil, or lolgo
Code that's running:
outputError <- err
fmt.Println("t.connection (pre): ", t.connection)
if t.connection != nil {
fmt.Println("t.connection (post): ", t.connection)
fmt.Println("err: ", err)
t.connection.Close()
t.connection = nil
Output produced:
t.connection (pre): <nil>
t.connection (post): <nil>
err: dial tcp 127.0.0.1:5575: connection refused
panic: runtime error: invalid memory address or nil pointer dereference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment