MCPcopy
hub / github.com/google/go-jsonnet / base64DecodeGoBytes

Function base64DecodeGoBytes

builtins.go:1475–1488  ·  view source on GitHub ↗
(i *interpreter, str string)

Source from the content-addressed store, hash-verified

1473}
1474
1475func base64DecodeGoBytes(i *interpreter, str string) ([]byte, error) {
1476 strLen := len(str)
1477 if strLen%4 != 0 {
1478 msg := fmt.Sprintf("input string appears not to be a base64 encoded string. Wrong length found (%d)", strLen)
1479 return nil, makeRuntimeError(msg, i.getCurrentStackTrace())
1480 }
1481
1482 decodedBytes, err := base64.StdEncoding.DecodeString(str)
1483 if err != nil {
1484 return nil, i.Error(fmt.Sprintf("failed to decode: %s", err))
1485 }
1486
1487 return decodedBytes, nil
1488}
1489
1490func builtinBase64DecodeBytes(i *interpreter, input value) (value, error) {
1491 vStr, err := i.getString(input)

Callers 2

builtinBase64DecodeBytesFunction · 0.85
builtinBase64DecodeFunction · 0.85

Calls 3

makeRuntimeErrorFunction · 0.85
getCurrentStackTraceMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…