- Module github.com/eslider/go-config with env/yaml/json/ini packages - internal: source, keymap, merge, structconv, bytesutil - cmd/envc: convert, get, merge - docs/asr ASR-0001..0008, README/CHANGELOG/AGENTS refresh - golangci-lint v2 config; tests + fixtures Co-authored-by: Cursor <cursoragent@cursor.com>
20 lines
395 B
Go
20 lines
395 B
Go
// Package bytesutil reads entire sources into memory.
|
|
package bytesutil
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"github.com/eslider/go-config/internal/source"
|
|
)
|
|
|
|
// ReadAll reads and closes the stream opened by s.
|
|
func ReadAll(ctx context.Context, s source.Source) ([]byte, error) {
|
|
rc, err := s.Open(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer func() { _ = rc.Close() }()
|
|
return io.ReadAll(rc)
|
|
}
|