diff --git a/config/interpolate_funcs.go b/config/interpolate_funcs.go index 22acfb3d4adb..9b26c24ff2d8 100644 --- a/config/interpolate_funcs.go +++ b/config/interpolate_funcs.go @@ -138,16 +138,6 @@ func interpolationFuncFormatList() ast.Function { parts := StringList(s).Slice() - // 0 or 1 length lists are treated as scalars and repeated - switch len(parts) { - case 0: - varargs[i-1] = "" - continue - case 1: - varargs[i-1] = parts[0] - continue - } - // otherwise the list is sent down to be indexed varargs[i-1] = parts diff --git a/config/interpolate_funcs_test.go b/config/interpolate_funcs_test.go index e6379fc01425..3258bda5c449 100644 --- a/config/interpolate_funcs_test.go +++ b/config/interpolate_funcs_test.go @@ -190,23 +190,18 @@ func TestInterpolateFuncFormatList(t *testing.T) { "A=1, B=2, C=3", false, }, - // formatlist of lists of length zero/one are repeated, just as scalars are - { - `${join(", ", formatlist("%s=%s", split(",", ""), split(",", "1,2,3")))}`, - "=1, =2, =3", - false, - }, - { - `${join(", ", formatlist("%s=%s", split(",", "A"), split(",", "1,2,3")))}`, - "A=1, A=2, A=3", - false, - }, // Mismatched list lengths generate an error { `${formatlist("%s=%2s", split(",", "A,B,C,D"), split(",", "1,2,3"))}`, nil, true, }, + // Works with lists of length 1 [GH-2240] + { + `${formatlist("%s.id", split(",", "demo-rest-elb"))}`, + NewStringList([]string{"demo-rest-elb.id"}).String(), + false, + }, }, }) }