16 lines
235 B
Go
16 lines
235 B
Go
package cmdutil
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
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)
|
|
}
|