Skip to content

Commit

Permalink
Include error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasbender authored and ForestEckhardt committed Jul 12, 2024
1 parent 7222905 commit b6530bc
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scribe/formatted_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ func NewFormattedMapFromEnvironment(environment map[string]string) FormattedMap
case parts[1] == "override" || parts[1] == "default":
envMap[parts[0]] = value
case parts[1] == "prepend":
if existingValue, ok := envMap[parts[0]]; ok {
envMap[parts[0]] = strings.Join([]string{value, existingValue.(string)}, environment[parts[0]+".delim"])
} else {
envMap[parts[0]] = strings.Join([]string{value, "$" + parts[0]}, environment[parts[0]+".delim"])
existingValue, ok := envMap[parts[0]]
if !ok {
existingValue = "$" + parts[0]
}
envMap[parts[0]] = strings.Join([]string{value, fmt.Sprintf("%v", existingValue)}, environment[parts[0]+".delim"])
case parts[1] == "append":
if existingValue, ok := envMap[parts[0]]; ok {
envMap[parts[0]] = strings.Join([]string{existingValue.(string), value}, environment[parts[0]+".delim"])
} else {
envMap[parts[0]] = strings.Join([]string{"$" + parts[0], value}, environment[parts[0]+".delim"])
existingValue, ok := envMap[parts[0]]
if !ok {
existingValue = "$" + parts[0]
}
envMap[parts[0]] = strings.Join([]string{fmt.Sprintf("%v", existingValue), value}, environment[parts[0]+".delim"])
}
}

Expand Down

0 comments on commit b6530bc

Please sign in to comment.