hashicorp / hcl2

Former temporary home for experimental new version of HCL
https://github.com/hashicorp/hcl
Mozilla Public License 2.0
373 stars 66 forks source link

gohcl decoder and entity indexes #34

Closed sigil66 closed 6 years ago

sigil66 commented 6 years ago

The gohcl package is nearly perfect for my requirements. I have found however the need to know the index of a given entity with a document following decode, due to the items being decoded into arrays of different types.

Example:

Task "snarf" {
  TypeOne {
     prop = "whatevs"
  }
  TypeTwo {
    another_prop = "something"
  }
}

If for example the high level decoder could dump the start from Range into a named field that would be ideal. Otherwise I will need to move to the next highest level decoder.

I am reticent to decode the sub entities on the fly.

What are your thoughts regarding discovering entity ordering utilizing the high level decoder?

sigil66 commented 6 years ago

Opted for indexing the document after evaluation.