(file string)
| 990 | } |
| 991 | |
| 992 | func 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 | |
| 1011 | func fieldExists(value interface{}, field string) bool { |
| 1012 | element := reflect.ValueOf(value).Elem() |
no outgoing calls
no test coverage detected