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:
parent
bf83b435e1
commit
9d0faa2cae
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue