multipart.Part, returned by multipart.Reader's NextPart method, have a Close() method. The only example here https://pkg.go.dev/mime/multipart#NewReader doesn't use the Close() method at all, so what's it purpose? Can we safely ignore it?
The reason I'm asking is that, calling *defer part.Closer *is a bit annoying when you loop through a Reader (see the example mentioned above). Calling the defer within the loop means all parts are closed at the end of the function. The alternative would be to have an anonymous function within the loop and call defer within it, but it feels so awkward. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/7d20c337-6037-4020-9f80-bc5cc86aa115n%40googlegroups.com.