MCPcopy
hub / github.com/hashicorp/hcl / String

Method String

pos.go:130–146  ·  view source on GitHub ↗

String returns a compact string representation of the receiver. Callers should generally prefer to present a range more visually, e.g. via markers directly on the relevant portion of source code.

()

Source from the content-addressed store, hash-verified

128// Callers should generally prefer to present a range more visually,
129// e.g. via markers directly on the relevant portion of source code.
130func (r Range) String() string {
131 if r.Start.Line == r.End.Line {
132 return fmt.Sprintf(
133 "%s:%d,%d-%d",
134 r.Filename,
135 r.Start.Line, r.Start.Column,
136 r.End.Column,
137 )
138 } else {
139 return fmt.Sprintf(
140 "%s:%d,%d-%d,%d",
141 r.Filename,
142 r.Start.Line, r.Start.Column,
143 r.End.Line, r.End.Column,
144 )
145 }
146}
147
148func (r Range) Empty() bool {
149 return r.Start.Byte == r.End.Byte

Callers 12

TestDiagnosticTextWriterFunction · 0.45
visRangeOffsetsFunction · 0.45
traversalStrMethod · 0.45
JustAttributesMethod · 0.45
mergedContentMethod · 0.45
ImpliedBodySchemaFunction · 0.45
getFieldTagsFunction · 0.45
DecodeBodyFunction · 0.45
decodeBodyToValueFunction · 0.45
decodeBodyToStructFunction · 0.45
tryFunction · 0.45
TypeStringFunction · 0.45

Calls

no outgoing calls

Tested by 2

TestDiagnosticTextWriterFunction · 0.36
visRangeOffsetsFunction · 0.36