mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551)
Found using
`find . -type f -name '*.go' -print -exec vim {} -c
':%s/fmt\.Errorf(\(.*\)%v\(.*\)err/fmt.Errorf(\1%w\2err/g' -c ':wq' \;`
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
			
			
This commit is contained in:
		@@ -28,20 +28,20 @@ func DeleteOrganization(org *organization.Organization) error {
 | 
			
		||||
	// Check ownership of repository.
 | 
			
		||||
	count, err := repo_model.CountRepositories(ctx, repo_model.CountRepositoryOptions{OwnerID: org.ID})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("GetRepositoryCount: %v", err)
 | 
			
		||||
		return fmt.Errorf("GetRepositoryCount: %w", err)
 | 
			
		||||
	} else if count > 0 {
 | 
			
		||||
		return models.ErrUserOwnRepos{UID: org.ID}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Check ownership of packages.
 | 
			
		||||
	if ownsPackages, err := packages_model.HasOwnerPackages(ctx, org.ID); err != nil {
 | 
			
		||||
		return fmt.Errorf("HasOwnerPackages: %v", err)
 | 
			
		||||
		return fmt.Errorf("HasOwnerPackages: %w", err)
 | 
			
		||||
	} else if ownsPackages {
 | 
			
		||||
		return models.ErrUserOwnPackages{UID: org.ID}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := organization.DeleteOrganization(ctx, org); err != nil {
 | 
			
		||||
		return fmt.Errorf("DeleteOrganization: %v", err)
 | 
			
		||||
		return fmt.Errorf("DeleteOrganization: %w", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := commiter.Commit(); err != nil {
 | 
			
		||||
@@ -54,13 +54,13 @@ func DeleteOrganization(org *organization.Organization) error {
 | 
			
		||||
	path := user_model.UserPath(org.Name)
 | 
			
		||||
 | 
			
		||||
	if err := util.RemoveAll(path); err != nil {
 | 
			
		||||
		return fmt.Errorf("Failed to RemoveAll %s: %v", path, err)
 | 
			
		||||
		return fmt.Errorf("Failed to RemoveAll %s: %w", path, err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(org.Avatar) > 0 {
 | 
			
		||||
		avatarPath := org.CustomAvatarRelativePath()
 | 
			
		||||
		if err := storage.Avatars.Delete(avatarPath); err != nil {
 | 
			
		||||
			return fmt.Errorf("Failed to remove %s: %v", avatarPath, err)
 | 
			
		||||
			return fmt.Errorf("Failed to remove %s: %w", avatarPath, err)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user