Skip to content

Commit

Permalink
use AppendSlice
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaytonNorthey92 committed Jun 25, 2024
1 parent 7b80763 commit ebe4ed0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ func Parse(c CfgMap) error {

reflect.ValueOf(v.Value).Elem().SetBool(val)
case reflect.Slice:
*(v.Value.(*[]string)) = strings.Split(envValue, ",")
// we assume that the slice here can be appended to (ex. an empty slice)
reflect.AppendSlice(reflect.ValueOf(v.Value), reflect.ValueOf(strings.Split(envValue, ",")))

default:
return fmt.Errorf("unsuported type for %v: %v",
Expand Down

0 comments on commit ebe4ed0

Please sign in to comment.