Created
December 17, 2014 01:10
-
-
Save compnski/d30c9cc0463b3fbcb6de to your computer and use it in GitHub Desktop.
This file contains 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" | |
import "io" | |
type notACloser struct { | |
Close func() error | |
} | |
func close() error { | |
fmt.Println("Close called") | |
return nil; | |
} | |
func closeme(cls io.Closer) { | |
cls.Close() | |
} | |
func main() { | |
nc := notACloser{Close:close} | |
nc.Close() | |
closeme(nc) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment