Skip to content

Commit

Permalink
env: trim excessive quotes from strings
Browse files Browse the repository at this point in the history
  • Loading branch information
rjeczalik committed Apr 7, 2022
1 parent 450a4f4 commit 2bd25f6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion format.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ func (c *envCodec) marshal(v interface{}) ([]byte, error) {
)

for _, k := range keys {
fmt.Fprintf(&buf, "%s%s=%q\n", p, strings.ToUpper(k), envs[k])
v := fmt.Sprintf("%q", envs[k])

if _, ok := envs[k].(string); ok {
v = strings.Trim(v, `"`)
}

fmt.Fprintf(&buf, "%s%s=%s\n", p, strings.ToUpper(k), v)
}

return buf.Bytes(), nil
Expand Down

0 comments on commit 2bd25f6

Please sign in to comment.