@@ -122,8 +122,8 @@ func Parse(r io.Reader) (envMap map[string]string, err error) {
122
122
return
123
123
}
124
124
125
- //ParseString reads an env file from a string, returning a map of keys and values.
126
- func ParseString (str string ) (envMap map [string ]string , err error ) {
125
+ //Unmarshal reads an env file from a string, returning a map of keys and values.
126
+ func Unmarshal (str string ) (envMap map [string ]string , err error ) {
127
127
return Parse (strings .NewReader (str ))
128
128
}
129
129
@@ -146,7 +146,7 @@ func Exec(filenames []string, cmd string, cmdArgs []string) error {
146
146
147
147
// Write serializes the given environment and writes it to a file
148
148
func Write (envMap map [string ]string , filename string ) error {
149
- content , error := WriteString (envMap )
149
+ content , error := Marshal (envMap )
150
150
if error != nil {
151
151
return error
152
152
}
@@ -158,10 +158,9 @@ func Write(envMap map[string]string, filename string) error {
158
158
return err
159
159
}
160
160
161
- // WriteString outputs the given environment as a dotenv-formatted environment file.
162
- //
161
+ // Marshal outputs the given environment as a dotenv-formatted environment file.
163
162
// Each line is in the format: KEY="VALUE" where VALUE is backslash-escaped.
164
- func WriteString (envMap map [string ]string ) (string , error ) {
163
+ func Marshal (envMap map [string ]string ) (string , error ) {
165
164
lines := make ([]string , 0 , len (envMap ))
166
165
for k , v := range envMap {
167
166
lines = append (lines , fmt .Sprintf (`%s="%s"` , k , doubleQuoteEscape (v )))
0 commit comments