INNER CODE UNIT · Go
depth
open-policy-agent/conftest · document/metadata.go:93
depth := len(entry.Path) - offset
// If the user is targeting a submodule we need to adjust the depth an offset base on the first annotation found
if i == 0 && depth > 1 {
offset = depth
}
// We need to compensate for unexpected jump in depth
// otherwise we would start at h3 if no package documentation is present
// or jump form h2 to h4 unexpectedly in subpackages
if (depth - currentDepth) > 1 {
depth = currentDepth + 1
}
currentDepth = depth
h := strings.Repeat("#", depth)
path := strings.TrimPrefix(entry.Path.String(), "data.")