Help us shape the future of Go! Take the 2026 Go Developer Survey

path

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package path provides a Terraform attribute type for Windows file paths that suppresses spurious plan-vs-apply diffs from cosmetic representation differences. See Path.StringSemanticEquals for the normalization it applies.

Index

Constants

This section is empty.

Variables

View Source
var Type = pathType{}

Type is the singleton attribute type for Windows file paths. Pass it as `CustomType:` on string attributes whose value is a path emitted by a Hyper-V cmdlet.

Functions

This section is empty.

Types

type Path

type Path struct {
	basetypes.StringValue
}

Path is the attribute-value implementation. Embeds StringValue so the .ValueString() / .IsNull() / .IsUnknown() accessors that resource code uses continue to work unchanged after a schema's CustomType is set to path.Type.

func NewPathNull

func NewPathNull() Path

NewPathNull constructs a null Path. Convenient for collapsing empty optional-attribute reads to schema-null on the wire.

func NewPathUnknown

func NewPathUnknown() Path

NewPathUnknown constructs an unknown Path. Used in plan modification when a value depends on apply-time information.

func NewPathValue

func NewPathValue(value string) Path

NewPathValue constructs a known, non-null Path. Convenient when hydrating a model from a typed-client struct on Read.

func (Path) Equal

func (p Path) Equal(o attr.Value) bool

Equal compares two Path values for raw equality (byte-for-byte). The framework calls this for known-after-apply tracking and other plan-machinery checks where we DO want strict equality. Semantic equality is the separate StringSemanticEquals method.

func (Path) StringSemanticEquals

func (p Path) StringSemanticEquals(_ context.Context, newValuable basetypes.StringValuable) (bool, diag.Diagnostics)

StringSemanticEquals normalizes both sides (slashes folded to backslash, lowercased) before comparing, so a user-written C:/foo and Hyper-V's echoed C:\foo compare equal and the framework suppresses the diff. The framework only calls this when both sides are known and non-null; null/unknown handling happens before this method runs.

func (Path) Type

func (p Path) Type(_ context.Context) attr.Type

Type returns the singleton attribute type. Required by attr.Value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL