go fmt the "compact" function changes.

This commit is contained in:
Martin Atkins 2015-10-10 15:17:25 -07:00
parent 3040d8419f
commit 16b11e443d
3 changed files with 13 additions and 14 deletions

View File

@ -20,17 +20,17 @@ var Funcs map[string]ast.Function
func init() { func init() {
Funcs = map[string]ast.Function{ Funcs = map[string]ast.Function{
"compact": interpolationFuncCompact(), "compact": interpolationFuncCompact(),
"concat": interpolationFuncConcat(), "concat": interpolationFuncConcat(),
"element": interpolationFuncElement(), "element": interpolationFuncElement(),
"file": interpolationFuncFile(), "file": interpolationFuncFile(),
"format": interpolationFuncFormat(), "format": interpolationFuncFormat(),
"formatlist": interpolationFuncFormatList(), "formatlist": interpolationFuncFormatList(),
"index": interpolationFuncIndex(), "index": interpolationFuncIndex(),
"join": interpolationFuncJoin(), "join": interpolationFuncJoin(),
"length": interpolationFuncLength(), "length": interpolationFuncLength(),
"replace": interpolationFuncReplace(), "replace": interpolationFuncReplace(),
"split": interpolationFuncSplit(), "split": interpolationFuncSplit(),
"base64encode": interpolationFuncBase64Encode(), "base64encode": interpolationFuncBase64Encode(),
"base64decode": interpolationFuncBase64Decode(), "base64decode": interpolationFuncBase64Decode(),
} }

View File

@ -11,7 +11,6 @@ import (
"github.com/hashicorp/terraform/config/lang/ast" "github.com/hashicorp/terraform/config/lang/ast"
) )
func TestInterpolateFuncCompact(t *testing.T) { func TestInterpolateFuncCompact(t *testing.T) {
testFunction(t, testFunctionConfig{ testFunction(t, testFunctionConfig{
Cases: []testFunctionCase{ Cases: []testFunctionCase{

View File

@ -28,11 +28,11 @@ const stringListDelim = `B780FFEC-B661-4EB8-9236-A01737AD98B6`
func (sl StringList) Compact() StringList { func (sl StringList) Compact() StringList {
parts := sl.Slice() parts := sl.Slice()
newlist := []string{} newlist := []string{}
// drop the empty strings // drop the empty strings
for i := range parts { for i := range parts {
if parts[i] != "" { if parts[i] != "" {
newlist = append(newlist, parts[i]) newlist = append(newlist, parts[i])
} }
} }
return NewStringList(newlist) return NewStringList(newlist)