From 9d0faa2cae80fee57674a575d53baef2910e1089 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Thu, 4 Aug 2016 17:17:41 -0400 Subject: [PATCH] Strip off extra \n in hcl encoded variables They don't change the value, but they do currently end up in the UI --- command/hcl_printer.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/command/hcl_printer.go b/command/hcl_printer.go index dbf1797f5..7947bb815 100644 --- a/command/hcl_printer.go +++ b/command/hcl_printer.go @@ -35,7 +35,13 @@ func encodeHCL(i interface{}) ([]byte, error) { // now strip that first assignment off eq := regexp.MustCompile(`=\s+`).FindIndex(hcl) - return hcl[eq[1]:], nil + // strip of an extra \n if it's there + end := len(hcl) + if hcl[end-1] == '\n' { + end -= 1 + } + + return hcl[eq[1]:end], nil } type encodeState struct {