// 创建UUID为名,指定后缀的文件 // ext string 后缀名,不含"." // basePath string 文件路径名,"/mnt/hhcehua/images" func CreateFileWithNewUUIDNameUseExtendBesideMkAllDir(ext string, basePath string) (*os.File, string, error) { u5, _ := uuid.NewV4() var nmExt string if strings.HasPrefix(ext, `.`) { nmExt = u5.String() + ext } else { nmExt = u5.String() + `.` + ext } flPath := basePath + nmExt fl, err := CreateFileBesidesAllDir(flPath) return fl, flPath, err }
// (私有方法)获取UUID字符串 func (manager *Manager) sessionID() string { u5, _ := uuid.NewV4() return u5.String() }