MCPcopy
hub / github.com/cloudfoundry/cli / Asset

Function Asset

i18n/resources/i18n_resources.go:283–293  ·  view source on GitHub ↗

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

(name string)

Source from the content-addressed store, hash-verified

281// It returns an error if the asset could not be found or
282// could not be loaded.
283func Asset(name string) ([]byte, error) {
284 canonicalName := strings.Replace(name, "\\", "/", -1)
285 if f, ok := _bindata[canonicalName]; ok {
286 a, err := f()
287 if err != nil {
288 return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
289 }
290 return a.bytes, nil
291 }
292 return nil, fmt.Errorf("Asset %s not found", name)
293}
294
295// MustAsset is like Asset but panics when Asset would return an error.
296// It simplifies safe initialization of global variables.

Callers 3

loadAssetFromResourcesFunction · 0.92
MustAssetFunction · 0.85
RestoreAssetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected