Files
opentf/internal/modules/with_range.go
Martin Atkins 4397d5bb72 modules: Start of decoding the declarations in a module
For now this is only for input variables, and only far enough to get their
names and detect duplicates. More to come in future commits.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-08-01 12:15:50 -07:00

31 lines
668 B
Go

// Copyright (c) The OpenTofu Authors
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) 2023 HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package modules
import (
"github.com/hashicorp/hcl/v2"
"github.com/opentofu/opentofu/internal/tfdiags"
)
type WithSourceRange[T any] struct {
Value T
SourceRange tfdiags.SourceRange
}
func withHCLSourceRange[T any](v T, rng hcl.Range) WithSourceRange[T] {
return WithSourceRange[T]{
Value: v,
SourceRange: tfdiags.SourceRangeFromHCL(rng),
}
}
func withSourceRange[T any](v T, rng tfdiags.SourceRange) WithSourceRange[T] {
return WithSourceRange[T]{
Value: v,
SourceRange: rng,
}
}