mirror of
https://github.com/rocky-linux/peridot.git
synced 2024-11-24 14:11:25 +00:00
ad0f7a5305
Upgrade to Go 1.20.5, Hydra v2 SDK, rules-go v0.44.2 (with proper resolves), protobuf v25.3 and mass upgrade of Go dependencies.
20 lines
386 B
Go
20 lines
386 B
Go
package utilities
|
|
|
|
import (
|
|
"bytes"
|
|
"io"
|
|
)
|
|
|
|
// IOReaderFactory takes in an io.Reader and returns a function that will allow you to create a new reader that begins
|
|
// at the start of the stream
|
|
func IOReaderFactory(r io.Reader) (func() io.Reader, error) {
|
|
b, err := io.ReadAll(r)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return func() io.Reader {
|
|
return bytes.NewReader(b)
|
|
}, nil
|
|
}
|