mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-07 22:53:08 -06:00
Return an empty slice for empty string lists
This commit is contained in:
parent
53f44878ff
commit
8e4a313f17
@ -69,11 +69,11 @@ func (sl StringList) Length() int {
|
||||
func (sl StringList) Slice() []string {
|
||||
parts := strings.Split(string(sl), stringListDelim)
|
||||
|
||||
// split on an empty StringList will have a length of 2, since there is
|
||||
// always at least one deliminator
|
||||
switch len(parts) {
|
||||
case 0, 1:
|
||||
case 0, 1, 2:
|
||||
return []string{}
|
||||
case 2:
|
||||
return []string{""}
|
||||
}
|
||||
|
||||
// strip empty elements generated by leading and trailing delimiters
|
||||
|
Loading…
Reference in New Issue
Block a user