printer: fix printing of lists

This commit is contained in:
Fatih Arslan 2015-10-25 19:09:22 +03:00
parent 5e525249f3
commit ccbedaa032
3 changed files with 10 additions and 4 deletions

View File

@ -85,12 +85,14 @@ func (p *printer) list(l *ast.ListType) []byte {
for i, item := range l.List {
if item.Pos().Line != l.Lbrack.Line {
// not same line
// multiline list, add newline before we add each item
buf.WriteByte(newline)
// also indent each line
buf.Write(p.indent(p.output(item)))
} else {
buf.Write(p.output(item))
}
buf.Write(p.indent(p.output(item)))
if i != len(l.List)-1 {
buf.WriteString(",")
buf.WriteByte(blank)

View File

@ -3,6 +3,8 @@ variable "foo" {
description = "bar"
}
developer = ["fatih", "arslan"]
provider "aws" {
access_key = "foo"
secret_key = "bar"
@ -31,7 +33,7 @@ resource aws_instance "web" {
resource "aws_instance" "db" {
security_groups = "${aws_security_group.firewall.*.id}"
VPC = "foo"
depends_on = [ "aws_instance.web"]
depends_on = ["aws_instance.web"]
}
output "web_ip" {

View File

@ -4,6 +4,8 @@ variable "foo" {
description = "bar"
}
developer = [ "fatih", "arslan"]
provider "aws" {
access_key ="foo"
secret_key = "bar"