Last active
April 17, 2018 22:05
-
-
Save aaronhurt/a2014233e683538e1165a0e6d8578734 to your computer and use it in GitHub Desktop.
HCL heredoc stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/hashicorp/hcl" | |
) | |
const myHCL = `foo { | |
bar = [<<EOF | |
"adsf asdf" | |
EOF | |
, <<EOF | |
asdf asdf, | |
EOF | |
] | |
}` | |
type fooBar struct { | |
Foo struct { | |
Bar []string | |
} | |
} | |
func main() { | |
fb := &fooBar{} | |
err := hcl.Decode(fb, myHCL) | |
fmt.Printf("out: %+v\nlen: %d\nerr: %s", fb, len(fb.Foo.Bar), err) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running ...