Strip off extra \n in hcl encoded variables

They don't change the value, but they do currently end up in the UI
This commit is contained in:
James Bardin 2016-08-04 17:17:41 -04:00
parent bf83b435e1
commit 9d0faa2cae
1 changed files with 7 additions and 1 deletions

View File

@ -35,7 +35,13 @@ func encodeHCL(i interface{}) ([]byte, error) {
// now strip that first assignment off // now strip that first assignment off
eq := regexp.MustCompile(`=\s+`).FindIndex(hcl) 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 { type encodeState struct {