title: Null vs nil in golang?
body: <p>I ran into a strange bug today. I had a function:</p>
  
  <pre><code>func Foo(s *someStruct) {
      fmt.Printf("s is %v\n", s)
      if s!=nil {
          fmt.Printf("s is not nil")
          ...
      }
  }
  </code></pre>
  
  <p>I would call the function like:</p>
  
  <pre><code>var s *someStruct
  Foo(s)
  </code></pre>
  
  <p>And then I decided to convert the structure into interface:</p>
  
  <pre><code>func Foo(s someStructInterface) {
      fmt.Printf("s is %v\n", s)
      if s!=nil {
          fmt.Printf("s is not nil")
          ...
      }
  }
  </code></pre>
  
  <p>Which gave me a strange output:</p>
  
  <pre><code>s is null
  s is not nil
  </code></pre>
  
  <p>While I expected to get <code>s is nil</code>, which is what I was getting usually. What is the difference between null and nil in this scenario in Go and how can I check if something is null or nil to execute the code properly?</p>