Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix some typos #519

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
## v2.10.1 (July 21, 2021)

* dynblock: Decode unknown dynamic blocks in order to obtain any diagnostics even though the decoded value is not used ([#476](https://github.com/hashicorp/hcl/pull/476))
* hclsyntax: Calling functions is now more robust in the face of an incorrectly-implemented function which returns a `function.ArgError` whose argument index is out of range for the length of the arguments. Previously this would often lead to a panic, but now it'll return a less-precice error message instead. Functions that return out-of-bounds argument indices still ought to be fixed so that the resulting error diagnostics can be as precise as possible. ([#472](https://github.com/hashicorp/hcl/pull/472))
* hclsyntax: Calling functions is now more robust in the face of an incorrectly-implemented function which returns a `function.ArgError` whose argument index is out of range for the length of the arguments. Previously this would often lead to a panic, but now it'll return a less-precise error message instead. Functions that return out-of-bounds argument indices still ought to be fixed so that the resulting error diagnostics can be as precise as possible. ([#472](https://github.com/hashicorp/hcl/pull/472))
* hclsyntax: Ensure marks on unknown values are maintained when processing string templates. ([#478](https://github.com/hashicorp/hcl/pull/478))
* hcl: Improved error messages for various common error situtions in `hcl.Index` and `hcl.GetAttr`. These are part of the implementation of indexing and attribute lookup in the native syntax expression language too, so the new error messages will apply to problems using those operators. ([#474](https://github.com/hashicorp/hcl/pull/474))

Expand Down Expand Up @@ -178,7 +178,7 @@

## v2.0.0 (Oct 2, 2019)

Initial release of HCL 2, which is a new implementating combining the HCL 1
Initial release of HCL 2, which is a new implementation combining the HCL 1
language with the HIL expression language to produce a single language
supporting both nested configuration structures and arbitrary expressions.

Expand Down
2 changes: 1 addition & 1 deletion gohcl/decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ func TestDecodeBody(t *testing.T) {
// Generating two diagnostics is good enough for this one.
// (one for the missing noodle block and the other for
// the JSON serialization detecting the missing level of
// heirarchy for the label.)
// hierarchy for the label.)
return true
},
2,
Expand Down
2 changes: 1 addition & 1 deletion gohcl/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func ImpliedBodySchema(val interface{}) (schema *hcl.BodySchema, partial bool) {

switch {
case field.Type.AssignableTo(exprType):
// If we're decoding to hcl.Expression then absense can be
// If we're decoding to hcl.Expression then absence can be
// indicated via a null value, so we don't specify that
// the field is required during decoding.
required = false
Expand Down
2 changes: 1 addition & 1 deletion guide/go_decoding_gohcl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ of labels is used.

By default, all declared attributes and blocks are considered to be required.
An optional value is indicated by making its field have a pointer type, in
which case ``nil`` is written to indicate the absense of the argument.
which case ``nil`` is written to indicate the absence of the argument.

The sections below discuss some additional decoding use-cases. For full details
on the `gohcl` package, see
Expand Down
4 changes: 2 additions & 2 deletions guide/go_decoding_lowlevel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ decoding API:

.. go:function:: func (b Body) JustAttributes() (Attributes, Diagnostics)

Decode the content from the receving body in a special *attributes-only*
Decode the content from the receiving body in a special *attributes-only*
mode, allowing the calling application to enumerate the arguments given
inside the body without needing to predict them in schema.

Expand All @@ -88,7 +88,7 @@ decoding API:

Returns a source range that points to where an absent required item in
the body might be placed. This is a "best effort" sort of thing, required
only to be somewhere inside the receving body, as a way to give source
only to be somewhere inside the receiving body, as a way to give source
location information for a "missing required argument" sort of error.

The main content-decoding methods each require a :go:type:`hcl.BodySchema`
Expand Down
2 changes: 1 addition & 1 deletion guide/go_diagnostics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ possible concerns that do not block processing.
HCL deviates from usual Go API practice by returning its own ``hcl.Diagnostics``
type, instead of Go's own ``error`` type. This allows functions to return
warnings without accompanying errors while not violating the usual expectation
that the absense of errors is indicated by a nil ``error``.
that the absence of errors is indicated by a nil ``error``.

In order to easily accumulate and return multiple diagnostics at once, the
usual pattern for functions returning diagnostics is to gather them in a
Expand Down
2 changes: 1 addition & 1 deletion guide/go_patterns.rst
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ requirement.
If error diagnostics are returned, the result is invalid and should not be
used.

This is the fucntion that Terraform uses to interpret the expression
This is the function that Terraform uses to interpret the expression
assigned to ``depends_on`` in our example above, then in turn using
``AbsTraversalForExpr`` on each enclosed expression.

Expand Down
4 changes: 2 additions & 2 deletions hcldec/public_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ b {
},
nil,
cty.DynamicVal,
1, // Unconsistent argument types in b blocks
1, // Inconsistent argument types in b blocks
},
{
`
Expand Down Expand Up @@ -524,7 +524,7 @@ b {
},
nil,
cty.DynamicVal,
1, // Unconsistent argument types in b blocks
1, // Inconsistent argument types in b blocks
},
{
`
Expand Down
8 changes: 4 additions & 4 deletions hcldec/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ func (s *BlockListSpec) decode(content *hcl.BodyContent, blockLabels []blockLabe
// FIXME: This is a pretty terrible error message.
diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: fmt.Sprintf("Unconsistent argument types in %s blocks", s.TypeName),
Summary: fmt.Sprintf("Inconsistent argument types in %s blocks", s.TypeName),
Detail: "Corresponding attributes in all blocks of this type must be the same.",
Subject: &sourceRanges[0],
})
Expand All @@ -530,7 +530,7 @@ func (s *BlockListSpec) decode(content *hcl.BodyContent, blockLabels []blockLabe
// FIXME: This is a pretty terrible error message.
diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: fmt.Sprintf("Unconsistent argument types in %s blocks", s.TypeName),
Summary: fmt.Sprintf("Inconsistent argument types in %s blocks", s.TypeName),
Detail: fmt.Sprintf("Block with index %d has inconsistent argument types: %s.", i, err),
Subject: &sourceRanges[i],
})
Expand Down Expand Up @@ -802,7 +802,7 @@ func (s *BlockSetSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel
// FIXME: This is a pretty terrible error message.
diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: fmt.Sprintf("Unconsistent argument types in %s blocks", s.TypeName),
Summary: fmt.Sprintf("Inconsistent argument types in %s blocks", s.TypeName),
Detail: "Corresponding attributes in all blocks of this type must be the same.",
Subject: &sourceRanges[0],
})
Expand All @@ -815,7 +815,7 @@ func (s *BlockSetSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel
// FIXME: This is a pretty terrible error message.
diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: fmt.Sprintf("Unconsistent argument types in %s blocks", s.TypeName),
Summary: fmt.Sprintf("Inconsistent argument types in %s blocks", s.TypeName),
Detail: fmt.Sprintf("Block with index %d has inconsistent argument types: %s.", i, err),
Subject: &sourceRanges[i],
})
Expand Down
2 changes: 1 addition & 1 deletion hclsyntax/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (e *LiteralValueExpr) AsTraversal() hcl.Traversal {
if e.Val.IsNull() {
// In practice the parser only generates null values of the dynamic
// pseudo-type for literals, so we can safely assume that any null
// was orignally the keyword "null".
// was originally the keyword "null".
return hcl.Traversal{
hcl.TraverseRoot{
Name: "null",
Expand Down
2 changes: 1 addition & 1 deletion hclsyntax/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/hashicorp/hcl/v2"
)

// Variables returns all of the variables referenced within a given experssion.
// Variables returns all of the variables referenced within a given expression.
//
// This is the implementation of the "Variables" method on every native
// expression.
Expand Down
2 changes: 1 addition & 1 deletion hclwrite/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ func tokenBracketChange(tok *Token) int {
// single-line comment token, represents the comment.
//
// When formatting, the leading spaces of the first tokens in each of these
// cells is adjusted to align vertically their occurences on consecutive
// cells is adjusted to align vertically their occurrences on consecutive
// rows.
type formatLine struct {
lead Tokens
Expand Down
2 changes: 1 addition & 1 deletion hclwrite/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ func TestTokenGenerateConsistency(t *testing.T) {

// This test verifies that different ways of generating equivalent token
// sequences all generate identical tokens, to help us keep them all in
// sync under future maintanence.
// sync under future maintenance.

t.Run("tuple constructor", func(t *testing.T) {
tests := map[string]struct {
Expand Down
2 changes: 1 addition & 1 deletion hclwrite/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (n *node) Detach() {
// currently in a list, this function will panic.
//
// The return value is the newly-constructed node, containing the given content.
// After this function returns, the reciever is no longer attached to a list.
// After this function returns, the receiver is no longer attached to a list.
func (n *node) ReplaceWith(c nodeContent) *node {
if n.list == nil {
panic("can't replace node that is not in a list")
Expand Down
4 changes: 2 additions & 2 deletions json/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ Token:
recover(p.Read())
return nil, diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Missing attribute seperator comma",
Summary: "Missing attribute separator comma",
Detail: "A comma must appear between each property definition in an object.",
Subject: p.Peek().Range.Ptr(),
})
Expand Down Expand Up @@ -344,7 +344,7 @@ Token:
recover(p.Read())
return nil, diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Missing attribute seperator comma",
Summary: "Missing attribute separator comma",
Detail: "A comma must appear between each value in an array.",
Subject: p.Peek().Range.Ptr(),
})
Expand Down
6 changes: 3 additions & 3 deletions pos.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,14 @@ func (r Range) Overlap(other Range) Range {
}

// PartitionAround finds the portion of the given range that overlaps with
// the reciever and returns three ranges: the portion of the reciever that
// the receiver and returns three ranges: the portion of the receiver that
// precedes the overlap, the overlap itself, and then the portion of the
// reciever that comes after the overlap.
// receiver that comes after the overlap.
//
// If the two ranges do not overlap then all three returned ranges are empty.
//
// If the given range aligns with or extends beyond either extent of the
// reciever then the corresponding outer range will be empty.
// receiver then the corresponding outer range will be empty.
func (r Range) PartitionAround(other Range) (before, overlap, after Range) {
overlap = r.Overlap(other)
if overlap.Empty() {
Expand Down