Skip to content

Commit b311b26

Browse files
authored
Fix: ioutil.ReadAll() is deprecated, so removed it's dependency (#202)
1 parent 4321598 commit b311b26

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: godotenv.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
package godotenv
1515

1616
import (
17+
"bytes"
1718
"errors"
1819
"fmt"
1920
"io"
20-
"io/ioutil"
2121
"os"
2222
"os/exec"
2323
"regexp"
@@ -30,12 +30,13 @@ const doubleQuoteSpecialChars = "\\\n\r\"!$`"
3030

3131
// Parse reads an env file from io.Reader, returning a map of keys and values.
3232
func Parse(r io.Reader) (map[string]string, error) {
33-
data, err := ioutil.ReadAll(r)
33+
var buf bytes.Buffer
34+
_, err := io.Copy(&buf, r)
3435
if err != nil {
3536
return nil, err
3637
}
3738

38-
return UnmarshalBytes(data)
39+
return UnmarshalBytes(buf.Bytes())
3940
}
4041

4142
// Load will read your env file(s) and load them into ENV for this process.

0 commit comments

Comments
 (0)