Skip to content

Instantly share code, notes, and snippets.

@akovardin
Created July 3, 2018 09:21
Show Gist options
  • Select an option

  • Save akovardin/4ee23533daf591db71ec1b5f74e448e9 to your computer and use it in GitHub Desktop.

Select an option

Save akovardin/4ee23533daf591db71ec1b5f74e448e9 to your computer and use it in GitHub Desktop.
Nill in receiver
package main
import (
"fmt"
)
type Example struct {
id int
}
func NewExample(i bool) *Example {
if i == true {
return &Example{}
}
return nil
}
func (e *Example) Call() {
fmt.Println("e", e)
}
func main() {
e := NewExample(false)
e.Call()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment