mirror of
https://github.com/burrowers/garble.git
synced 2026-04-22 15:47:04 +08:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user