mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00: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:
		| @@ -123,30 +123,30 @@ func createDelegateHooks(repoPath string) (err error) { | ||||
| 		newHookPath := filepath.Join(hookDir, hookName+".d", "gitea") | ||||
|  | ||||
| 		if err := os.MkdirAll(filepath.Join(hookDir, hookName+".d"), os.ModePerm); err != nil { | ||||
| 			return fmt.Errorf("create hooks dir '%s': %v", filepath.Join(hookDir, hookName+".d"), err) | ||||
| 			return fmt.Errorf("create hooks dir '%s': %w", filepath.Join(hookDir, hookName+".d"), err) | ||||
| 		} | ||||
|  | ||||
| 		// WARNING: This will override all old server-side hooks | ||||
| 		if err = util.Remove(oldHookPath); err != nil && !os.IsNotExist(err) { | ||||
| 			return fmt.Errorf("unable to pre-remove old hook file '%s' prior to rewriting: %v ", oldHookPath, err) | ||||
| 			return fmt.Errorf("unable to pre-remove old hook file '%s' prior to rewriting: %w ", oldHookPath, err) | ||||
| 		} | ||||
| 		if err = os.WriteFile(oldHookPath, []byte(hookTpls[i]), 0o777); err != nil { | ||||
| 			return fmt.Errorf("write old hook file '%s': %v", oldHookPath, err) | ||||
| 			return fmt.Errorf("write old hook file '%s': %w", oldHookPath, err) | ||||
| 		} | ||||
|  | ||||
| 		if err = ensureExecutable(oldHookPath); err != nil { | ||||
| 			return fmt.Errorf("Unable to set %s executable. Error %v", oldHookPath, err) | ||||
| 			return fmt.Errorf("Unable to set %s executable. Error %w", oldHookPath, err) | ||||
| 		} | ||||
|  | ||||
| 		if err = util.Remove(newHookPath); err != nil && !os.IsNotExist(err) { | ||||
| 			return fmt.Errorf("unable to pre-remove new hook file '%s' prior to rewriting: %v", newHookPath, err) | ||||
| 			return fmt.Errorf("unable to pre-remove new hook file '%s' prior to rewriting: %w", newHookPath, err) | ||||
| 		} | ||||
| 		if err = os.WriteFile(newHookPath, []byte(giteaHookTpls[i]), 0o777); err != nil { | ||||
| 			return fmt.Errorf("write new hook file '%s': %v", newHookPath, err) | ||||
| 			return fmt.Errorf("write new hook file '%s': %w", newHookPath, err) | ||||
| 		} | ||||
|  | ||||
| 		if err = ensureExecutable(newHookPath); err != nil { | ||||
| 			return fmt.Errorf("Unable to set %s executable. Error %v", oldHookPath, err) | ||||
| 			return fmt.Errorf("Unable to set %s executable. Error %w", oldHookPath, err) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 delvh
					delvh