Read reads the file to a string. All leading and trailing whitespace is removed.
()
| 97 | // Read reads the file to a string. All leading and trailing whitespace |
| 98 | // is removed. |
| 99 | func (f File) Read() (string, error) { |
| 100 | if f == "" { |
| 101 | return "", xerrors.Errorf("empty file path") |
| 102 | } |
| 103 | byt, err := read(string(f)) |
| 104 | return strings.TrimSpace(string(byt)), err |
| 105 | } |
| 106 | |
| 107 | // open opens a file in the configuration directory, |
| 108 | // creating all intermediate directories. |