MCPcopy Create free account
hub / github.com/belak/gitdir / validateGroupLoopInternal

Method validateGroupLoopInternal

config_validate.go:58–77  ·  view source on GitHub ↗
(groupName string, groupPath []string)

Source from the content-addressed store, hash-verified

56}
57
58func (c *Config) validateGroupLoopInternal(groupName string, groupPath []string) error {
59 // If we hit a group loop, return the path to get here
60 if listContainsStr(groupPath, groupName) {
61 return fmt.Errorf("group loop found: %s", strings.Join(append(groupPath, groupName), ", "))
62 }
63
64 groupPath = append(groupPath, groupName)
65
66 for _, lookup := range c.Groups[groupName] {
67 if strings.HasPrefix(lookup, groupPrefix) {
68 intGroupName := strings.TrimPrefix(lookup, groupPrefix)
69
70 if err := c.validateGroupLoopInternal(intGroupName, groupPath); err != nil {
71 return err
72 }
73 }
74 }
75
76 return nil
77}

Callers 1

validateGroupLoopMethod · 0.95

Calls 1

listContainsStrFunction · 0.85

Tested by

no test coverage detected