github.com/leowmjw/otto@v0.2.1-0.20160126165905-6400716cf085/app/close.go (about) 1 package app 2 3 import ( 4 "io" 5 ) 6 7 // Close is a function that can easily be deferred or called at any 8 // point and will close the given value if it is an io.Closer. 9 // 10 // This should be called with App implementations since they may be 11 // happening over RPC. 12 func Close(v interface{}) error { 13 if c, ok := v.(io.Closer); ok { 14 return c.Close() 15 } 16 17 return nil 18 }