Ensure that `close(quit)` is called only once in s3 Walk
requested to merge prevent-multiple-quit-closes into 3-optimize-the-s3-storage-driver-s-walk-function
In the case of two active goroutines that will both send on the errors channel, close(quit)
will be called more than once, causing a panic and more minorly, all but the first error to be ignored.
This MR ensures that close(quit)
is called only once and that all errors from in progress goroutines will be reported.
Errors are delimited by newlines.
This technique is employed in the WalkFallbackParallel function: https://gitlab.com/gitlab-org/container-registry/blob/3-optimize-the-s3-storage-driver-s-walk-function/registry/storage/driver/walk.go#L75
Edited by Hayley Swimelar