package file import ( "os" "path/filepath" ) func CreateFolder(userName, folderPath string) error { // 获取main.go所在的目录 currentDir, err := os.Getwd() if err != nil { return err } baseDir := filepath.Join(currentDir, "file_library") fullFolderPath := filepath.Join(baseDir, userName, folderPath) err = os.MkdirAll(fullFolderPath, 0755) if err != nil { return err } return nil }