MCPcopy
hub / github.com/cloudflare/cloudflared / IntSlice

Method IntSlice

config/configuration.go:340–359  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

338}
339
340func (c *configFileSettings) IntSlice(name string) ([]int, error) {
341 if raw, ok := c.Settings[name]; ok {
342 if slice, ok := raw.([]interface{}); ok {
343 intSlice := make([]int, len(slice))
344 for i, v := range slice {
345 str, ok := v.(int)
346 if !ok {
347 return nil, fmt.Errorf("expected int, found %T for %v ", v, v)
348 }
349 intSlice[i] = str
350 }
351 return intSlice, nil
352 }
353 if v, ok := raw.([]int); ok {
354 return v, nil
355 }
356 return nil, fmt.Errorf("expected int slice found %T for %s", raw, name)
357 }
358 return nil, nil
359}
360
361func (c *configFileSettings) Generic(name string) (cli.Generic, error) {
362 return nil, errors.New("option type Generic not supported")

Callers 1

TestConfigFileSettingsFunction · 0.95

Calls 1

ErrorfMethod · 0.80

Tested by 1

TestConfigFileSettingsFunction · 0.76