mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +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:
		@@ -32,12 +32,12 @@ func Dir(name string) ([]string, error) {
 | 
			
		||||
 | 
			
		||||
	isDir, err := util.IsDir(customDir)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return []string{}, fmt.Errorf("Unabe to check if custom directory %s is a directory. %v", customDir, err)
 | 
			
		||||
		return []string{}, fmt.Errorf("Unabe to check if custom directory %s is a directory. %w", customDir, err)
 | 
			
		||||
	}
 | 
			
		||||
	if isDir {
 | 
			
		||||
		files, err := util.StatDir(customDir, true)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return []string{}, fmt.Errorf("Failed to read custom directory. %v", err)
 | 
			
		||||
			return []string{}, fmt.Errorf("Failed to read custom directory. %w", err)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		result = append(result, files...)
 | 
			
		||||
@@ -47,12 +47,12 @@ func Dir(name string) ([]string, error) {
 | 
			
		||||
 | 
			
		||||
	isDir, err = util.IsDir(staticDir)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return []string{}, fmt.Errorf("unable to check if static directory %s is a directory. %v", staticDir, err)
 | 
			
		||||
		return []string{}, fmt.Errorf("unable to check if static directory %s is a directory. %w", staticDir, err)
 | 
			
		||||
	}
 | 
			
		||||
	if isDir {
 | 
			
		||||
		files, err := util.StatDir(staticDir, true)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return []string{}, fmt.Errorf("Failed to read static directory. %v", err)
 | 
			
		||||
			return []string{}, fmt.Errorf("Failed to read static directory. %w", err)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		result = append(result, files...)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user