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

Method SimpleSplit

traversal.go:142–150  ·  view source on GitHub ↗

SimpleSplit returns a TraversalSplit where the name lookup is the absolute part and the remainder is the relative part. Supported only for absolute traversals, and will panic if applied to a relative traversal. This can be used by applications that have a relatively-simple variable namespace where

()

Source from the content-addressed store, hash-verified

140// namespace where only the top-level is directly populated in the scope, with
141// everything else handled by relative lookups from those initial values.
142func (t Traversal) SimpleSplit() TraversalSplit {
143 if t.IsRelative() {
144 panic("can't use SimpleSplit on a relative traversal")
145 }
146 return TraversalSplit{
147 Abs: t[0:1],
148 Rel: t[1:],
149 }
150}
151
152// RootName returns the root name for a absolute traversal. Will panic if
153// called on a relative traversal.

Callers 1

TraverseAbsMethod · 0.95

Calls 1

IsRelativeMethod · 0.95

Tested by

no test coverage detected