Skip to content

Commit b2d0c5b

Browse files
committed
chore(go): use %w to wrap error instead of %s
1 parent 8f973f0 commit b2d0c5b

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

lang/golang/parser/parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (p *GoParser) collectGoMods(startDir string) error {
102102

103103
name, err := getModuleName(path)
104104
if err != nil {
105-
return fmt.Errorf("failed to get module name: %s", err.Error())
105+
return fmt.Errorf("failed to get module name: %w", err)
106106
}
107107

108108
rel, err := filepath.Rel(p.homePageDir, filepath.Dir(path))

lang/golang/parser/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func hasNoDeps(modFilePath string) bool {
167167
func getModuleName(modFilePath string) (string, error) {
168168
content, err := os.ReadFile(modFilePath)
169169
if err != nil {
170-
return "", fmt.Errorf("failed to read file: %s", err.Error())
170+
return "", fmt.Errorf("failed to read file: %w", err)
171171
}
172172

173173
return modfile.ModulePath(content), nil

0 commit comments

Comments
 (0)