Created
July 3, 2018 09:21
-
-
Save akovardin/4ee23533daf591db71ec1b5f74e448e9 to your computer and use it in GitHub Desktop.
Nill in receiver
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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