()
| 157 | c.Assert(called, NotNil) |
| 158 | } |
| 159 | func ExampleCheckClose() { |
| 160 | // CheckClose is commonly used with named return values |
| 161 | f := func() (err error) { |
| 162 | // Get a io.ReadCloser |
| 163 | r := io.NopCloser(strings.NewReader("foo")) |
| 164 | |
| 165 | // defer CheckClose call with an io.Closer and pointer to error |
| 166 | defer CheckClose(r, &err) |
| 167 | |
| 168 | // ... work with r ... |
| 169 | |
| 170 | // if err is not nil, CheckClose will assign any close errors to it |
| 171 | return err |
| 172 | } |
| 173 | |
| 174 | err := f() |
| 175 | if err != nil { |
| 176 | panic(err) |
| 177 | } |
| 178 | } |
nothing calls this directly
no test coverage detected