cli/pkg/cmdutil/file_input.go
Kynan Ware 9331ee8215 Add godoc comments to exported symbols in pkg/cmdutil
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-04 16:01:52 -07:00

17 lines
313 B
Go

package cmdutil
import (
"io"
"os"
)
// ReadFile reads the contents of filename, or from stdin if filename is "-".
func ReadFile(filename string, stdin io.ReadCloser) ([]byte, error) {
if filename == "-" {
b, err := io.ReadAll(stdin)
_ = stdin.Close()
return b, err
}
return os.ReadFile(filename)
}