From 89dbac5e997bd8acd1b00594ed4ca0d83040f1f8 Mon Sep 17 00:00:00 2001 From: cuishuang Date: Wed, 23 Mar 2022 19:52:14 +0800 Subject: [PATCH] fix some typos Signed-off-by: cuishuang --- CHANGELOG.md | 4 ++-- gohcl/decode_test.go | 2 +- gohcl/schema.go | 2 +- guide/go_decoding_gohcl.rst | 2 +- guide/go_decoding_lowlevel.rst | 4 ++-- guide/go_diagnostics.rst | 2 +- guide/go_patterns.rst | 2 +- hcldec/public_test.go | 4 ++-- hcldec/spec.go | 8 ++++---- hclsyntax/expression.go | 2 +- hclsyntax/variables.go | 2 +- hclwrite/format.go | 2 +- hclwrite/generate_test.go | 2 +- hclwrite/node.go | 2 +- json/parser.go | 4 ++-- pos.go | 6 +++--- 16 files changed, 25 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87b66bab..20d25e6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) @@ -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. diff --git a/gohcl/decode_test.go b/gohcl/decode_test.go index 50eaea7f..a849b88d 100644 --- a/gohcl/decode_test.go +++ b/gohcl/decode_test.go @@ -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, diff --git a/gohcl/schema.go b/gohcl/schema.go index df21cc49..f7d17ce1 100644 --- a/gohcl/schema.go +++ b/gohcl/schema.go @@ -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 diff --git a/guide/go_decoding_gohcl.rst b/guide/go_decoding_gohcl.rst index 7ef21260..74268bf6 100644 --- a/guide/go_decoding_gohcl.rst +++ b/guide/go_decoding_gohcl.rst @@ -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 diff --git a/guide/go_decoding_lowlevel.rst b/guide/go_decoding_lowlevel.rst index e0b5e997..d0da0655 100644 --- a/guide/go_decoding_lowlevel.rst +++ b/guide/go_decoding_lowlevel.rst @@ -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. @@ -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` diff --git a/guide/go_diagnostics.rst b/guide/go_diagnostics.rst index a9485427..19c31770 100644 --- a/guide/go_diagnostics.rst +++ b/guide/go_diagnostics.rst @@ -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 diff --git a/guide/go_patterns.rst b/guide/go_patterns.rst index 85a9022b..9313d241 100644 --- a/guide/go_patterns.rst +++ b/guide/go_patterns.rst @@ -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. diff --git a/hcldec/public_test.go b/hcldec/public_test.go index 20521fbe..18f544b5 100644 --- a/hcldec/public_test.go +++ b/hcldec/public_test.go @@ -442,7 +442,7 @@ b { }, nil, cty.DynamicVal, - 1, // Unconsistent argument types in b blocks + 1, // Inconsistent argument types in b blocks }, { ` @@ -524,7 +524,7 @@ b { }, nil, cty.DynamicVal, - 1, // Unconsistent argument types in b blocks + 1, // Inconsistent argument types in b blocks }, { ` diff --git a/hcldec/spec.go b/hcldec/spec.go index 42cb070d..d841406c 100644 --- a/hcldec/spec.go +++ b/hcldec/spec.go @@ -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], }) @@ -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], }) @@ -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], }) @@ -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], }) diff --git a/hclsyntax/expression.go b/hclsyntax/expression.go index 07464a6b..a0360042 100644 --- a/hclsyntax/expression.go +++ b/hclsyntax/expression.go @@ -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", diff --git a/hclsyntax/variables.go b/hclsyntax/variables.go index 3d68c413..38de5273 100644 --- a/hclsyntax/variables.go +++ b/hclsyntax/variables.go @@ -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. diff --git a/hclwrite/format.go b/hclwrite/format.go index 2b4ba323..e7949959 100644 --- a/hclwrite/format.go +++ b/hclwrite/format.go @@ -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 diff --git a/hclwrite/generate_test.go b/hclwrite/generate_test.go index 06fa0944..92903162 100644 --- a/hclwrite/generate_test.go +++ b/hclwrite/generate_test.go @@ -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 { diff --git a/hclwrite/node.go b/hclwrite/node.go index d3a5b72c..2cbfcb3f 100644 --- a/hclwrite/node.go +++ b/hclwrite/node.go @@ -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") diff --git a/json/parser.go b/json/parser.go index 6b7420b9..d99fbbcc 100644 --- a/json/parser.go +++ b/json/parser.go @@ -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(), }) @@ -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(), }) diff --git a/pos.go b/pos.go index 06db8bfb..3663c904 100644 --- a/pos.go +++ b/pos.go @@ -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() {