MCPcopy Create free account
hub / github.com/apache/openwhisk-cli / FileExists

Function FileExists

commands/util.go:992–1009  ·  view source on GitHub ↗
(file string)

Source from the content-addressed store, hash-verified

990}
991
992func FileExists(file string) (bool, error) {
993 _, err := os.Stat(file)
994
995 if err != nil {
996 if os.IsNotExist(err) == true {
997 return false, nil
998 } else {
999 whisk.Debug(whisk.DbgError, "os.Stat(%s) error: %#v\n", file, err)
1000 errMsg := wski18n.T("Cannot access file '{{.name}}': {{.err}}",
1001 map[string]interface{}{"name": file, "err": err})
1002 whiskErr := whisk.MakeWskError(errors.New(errMsg), whisk.EXIT_CODE_ERR_USAGE,
1003 whisk.DISPLAY_MSG, whisk.DISPLAY_USAGE)
1004 return true, whiskErr
1005 }
1006 }
1007
1008 return true, nil
1009}
1010
1011func fieldExists(value interface{}, field string) bool {
1012 element := reflect.ValueOf(value).Elem()

Callers 5

unpackGzipFunction · 0.85
unpackZipFunction · 0.85
unpackTarFunction · 0.85
ReadFileFunction · 0.85
saveCodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected