mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +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:
		@@ -64,7 +64,7 @@ func readUnmergedLsFileLines(ctx context.Context, tmpBasePath string, outputChan
 | 
			
		||||
	lsFilesReader, lsFilesWriter, err := os.Pipe()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error("Unable to open stderr pipe: %v", err)
 | 
			
		||||
		outputChan <- &lsFileLine{err: fmt.Errorf("unable to open stderr pipe: %v", err)}
 | 
			
		||||
		outputChan <- &lsFileLine{err: fmt.Errorf("unable to open stderr pipe: %w", err)}
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	defer func() {
 | 
			
		||||
@@ -117,7 +117,7 @@ func readUnmergedLsFileLines(ctx context.Context, tmpBasePath string, outputChan
 | 
			
		||||
			},
 | 
			
		||||
		})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		outputChan <- &lsFileLine{err: fmt.Errorf("git ls-files -u -z: %v", git.ConcatenateError(err, stderr.String()))}
 | 
			
		||||
		outputChan <- &lsFileLine{err: fmt.Errorf("git ls-files -u -z: %w", git.ConcatenateError(err, stderr.String()))}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -163,7 +163,7 @@ func unmergedFiles(ctx context.Context, tmpBasePath string, unmerged chan *unmer
 | 
			
		||||
		log.Trace("Got line: %v Current State:\n%v", line, next)
 | 
			
		||||
		if line.err != nil {
 | 
			
		||||
			log.Error("Unable to run ls-files -u -z! Error: %v", line.err)
 | 
			
		||||
			unmerged <- &unmergedFile{err: fmt.Errorf("unable to run ls-files -u -z! Error: %v", line.err)}
 | 
			
		||||
			unmerged <- &unmergedFile{err: fmt.Errorf("unable to run ls-files -u -z! Error: %w", line.err)}
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user