Files
go-config/internal/bytesutil/read.go
T
eSliderandCursor c575341178 feat(go-config): multi-format codecs, envc CLI, fixtures, ASRs
- 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>
2026-05-02 14:04:01 +01:00

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)
}