go1.25 bumped lib version added in dotenv assign func

This commit is contained in:
2025-09-18 23:22:39 +05:30
parent 2c1ceed904
commit ae4020fdcf
11 changed files with 127 additions and 53 deletions

View File

@@ -23,7 +23,7 @@ const (
)
func parseBytes(src []byte, out map[string]string) error {
src = bytes.Replace(src, []byte("\r\n"), []byte("\n"), -1)
src = bytes.ReplaceAll(src, []byte("\r\n"), []byte("\n"))
cutset := src
for {
cutset = getStatementStart(cutset)
@@ -76,8 +76,8 @@ func getStatementStart(src []byte) []byte {
func locateKeyName(src []byte) (key string, cutset []byte, err error) {
// trim "export" and space at beginning
src = bytes.TrimLeftFunc(src, isSpace)
if bytes.HasPrefix(src, []byte(exportPrefix)) {
trimmed := bytes.TrimPrefix(src, []byte(exportPrefix))
if after, ok := bytes.CutPrefix(src, []byte(exportPrefix)); ok {
trimmed := after
if bytes.IndexFunc(trimmed, isSpace) == 0 {
src = bytes.TrimLeftFunc(trimmed, isSpace)
}