internal/linker: return error instead of panicking for unsupported patches

Return a descriptive error instead of panicking when loadLinkerPatches
encounters an unsupported patch type (new/delete/copy/rename). This
gives a clear error message to the user instead of a stack trace.
This commit is contained in:
love
2026-03-05 19:03:59 +08:00
committed by Daniel Martí
parent ab88bbc70a
commit 9a4ecc2fff
+1 -1
View File
@@ -55,7 +55,7 @@ func loadLinkerPatches(majorGoVersion string) (version string, modFiles map[stri
}
for _, file := range files {
if file.IsNew || file.IsDelete || file.IsCopy || file.IsRename {
panic("only modification patch is supported")
return fmt.Errorf("unsupported patch type for %s: only modification patches are supported", file.OldName)
}
modFiles[file.OldName] = true
}