MCPcopy
hub / github.com/instrumenta/kubeval / getString

Function getString

kubeval/utils.go:51–64  ·  view source on GitHub ↗
(body map[string]interface{}, key string)

Source from the content-addressed store, hash-verified

49}
50
51func getString(body map[string]interface{}, key string) (string, error) {
52 value, found := body[key]
53 if !found {
54 return "", fmt.Errorf("Missing '%s' key", key)
55 }
56 if value == nil {
57 return "", fmt.Errorf("Missing '%s' value", key)
58 }
59 typedValue, ok := value.(string)
60 if !ok {
61 return "", fmt.Errorf("Expected string value for key '%s'", key)
62 }
63 return typedValue, nil
64}
65
66// detectLineBreak returns the relevant platform specific line ending
67func detectLineBreak(haystack []byte) string {

Callers 3

validateResourceFunction · 0.85
ValidateWithCacheFunction · 0.85
TestGetStringFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestGetStringFunction · 0.68