Skip to content

Commit

Permalink
gohcl: document optional attribute
Browse files Browse the repository at this point in the history
This documents the "optional" attribute, which allows you to specify an
attribute that is optional when parsing.
  • Loading branch information
vancluever committed Feb 14, 2020
1 parent cec773f commit 939ae58
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gohcl/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// attr (the default) indicates that the value is to be populated from an attribute
// block indicates that the value is to populated from a block
// label indicates that the value is to populated from a block label
// optional is the same as attr, but the field is optional
// remain indicates that the value is to be populated from the remaining body after populating other fields
//
// "attr" fields may either be of type *hcl.Expression, in which case the raw
Expand All @@ -34,6 +35,9 @@
// the blocks being decoded. In this case, the name token is used only as
// an identifier for the label in diagnostic messages.
//
// "optional" fields behave like "attr" fields, but they are optional
// and will not give parsing errors if they are missing.
//
// "remain" can be placed on a single field that may be either of type
// hcl.Body or hcl.Attributes, in which case any remaining body content is
// placed into this field for delayed processing. If no "remain" field is
Expand Down

0 comments on commit 939ae58

Please sign in to comment.