hcl
                                
                                
                                
                                    hcl copied to clipboard
                            
                            
                            
                        Fixing complex struct decoding bug
This fixes a longstanding and very annoying bug (#164) in HCL that IMO prevented anyone from seriously using it as a configuration language. I don't know why the decoder has that extra section, but I can't find any test that actually depends on that behavior, and removing that section fixes the issue. Obviously this should be reviewed closely since I have only looked at this codebase for a couple hours - but the bug seems to be resolved.
It appears that the test failure in travis-ci is unrelated to my change
$ make test
go generate ./...
go get -t ./...
go test ./... 
# github.com/hashicorp/hcl/hcl/ast
hcl/ast/ast_test.go:140: Error call has possible formatting directive %d
hcl/ast/ast_test.go:150: Error call has possible formatting directive %d
ok  	github.com/hashicorp/hcl	0.017s
FAIL	github.com/hashicorp/hcl/hcl/ast [build failed]
# github.com/hashicorp/hcl/hcl/fmtcmd
hcl/fmtcmd/fmtcmd_test.go:49: Errorf format %b has arg tc.Expected of wrong type bool
hcl/fmtcmd/fmtcmd_test.go:89: Errorf format %s has arg expectedOut of wrong type bytes.Buffer
hcl/fmtcmd/fmtcmd_test.go:135: Errorf format %s has arg expectedOut of wrong type bytes.Buffer
hcl/fmtcmd/fmtcmd_test.go:164: Errorf format %s has arg expectedOut of wrong type bytes.Buffer
hcl/fmtcmd/fmtcmd_test.go:245: Errorf format %s has arg expectedOut of wrong type bytes.Buffer
hcl/fmtcmd/fmtcmd_test.go:277: Errorf format %s has arg expectedOut of wrong type bytes.Buffer
FAIL	github.com/hashicorp/hcl/hcl/fmtcmd [build failed]
ok  	github.com/hashicorp/hcl/hcl/parser	0.003s
ok  	github.com/hashicorp/hcl/hcl/printer	0.005s
ok  	github.com/hashicorp/hcl/hcl/scanner	0.002s
ok  	github.com/hashicorp/hcl/hcl/strconv	0.015s
ok  	github.com/hashicorp/hcl/hcl/token	0.002s
ok  	github.com/hashicorp/hcl/json/parser	0.002s
ok  	github.com/hashicorp/hcl/json/scanner	0.004s
ok  	github.com/hashicorp/hcl/json/token	0.002s
?   	github.com/hashicorp/hcl/testhelper	[no test files]
make: *** [test] Error 2
Something changed in golang tip's formatting code?