MCPcopy
hub / github.com/caddyserver/caddy / parseCanonicalArrayIndex

Function parseCanonicalArrayIndex

admin.go:1139–1151  ·  view source on GitHub ↗
(idx string)

Source from the content-addressed store, hash-verified

1137}
1138
1139func parseCanonicalArrayIndex(idx string) (int, error) {
1140 if idx == "" {
1141 return 0, fmt.Errorf("empty index")
1142 }
1143 i, err := strconv.Atoi(idx)
1144 if err != nil {
1145 return 0, err
1146 }
1147 if strconv.Itoa(i) != idx {
1148 return 0, fmt.Errorf("non-canonical array index")
1149 }
1150 return i, nil
1151}
1152
1153// unsyncedConfigAccess traverses into the current config and performs
1154// the operation at path according to method, using body and out as

Callers 1

unsyncedConfigAccessFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected