Fix typo in dynamic_value.go (#541)

This commit is contained in:
Ikko Eltociear Ashimine 2023-09-26 20:40:33 +09:00 committed by GitHub
parent 7b799c9305
commit c15ae78b30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,9 +21,9 @@ import (
// the serialized form, whose format may change in future. Values of this
// type must always be created by calling NewDynamicValue.
//
// The zero value of DynamicValue is nil, and represents the absense of a
// The zero value of DynamicValue is nil, and represents the absence of a
// value within the Go type system. This is distinct from a cty.NullVal
// result, which represents the absense of a value within the cty type system.
// result, which represents the absence of a value within the cty type system.
type DynamicValue []byte
// NewDynamicValue creates a DynamicValue by serializing the given value
@ -36,14 +36,14 @@ type DynamicValue []byte
// value, and then also pass cty.DynamicPseudoType to method Decode to recover
// the original value.
//
// cty.NilVal can be used to represent the absense of a value, but callers
// cty.NilVal can be used to represent the absence of a value, but callers
// must be careful to distinguish values that are absent at the Go layer
// (cty.NilVal) vs. values that are absent at the cty layer (cty.NullVal
// results).
func NewDynamicValue(val cty.Value, ty cty.Type) (DynamicValue, error) {
// If we're given cty.NilVal (the zero value of cty.Value, which is
// distinct from a typed null value created by cty.NullVal) then we'll
// assume the caller is trying to represent the _absense_ of a value,
// assume the caller is trying to represent the _absence_ of a value,
// and so we'll return a nil DynamicValue.
if val == cty.NilVal {
return DynamicValue(nil), nil