1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-01 13:17:53 +02:00

Improve error reporting on config migration

This commit is contained in:
Karem Abdul-Samad 2025-01-24 10:59:47 -05:00 committed by Stefan Haller
parent 2bed09ef67
commit afc3061c51

View File

@ -245,9 +245,11 @@ func migrateUserConfig(path string, content []byte) ([]byte, error) {
// Write config back if changed
if string(changedContent) != string(content) {
fmt.Println("Provided user config is deprecated but auto-fixable. Attempting to write fixed version back to file...")
if err := os.WriteFile(path, changedContent, 0o644); err != nil {
return nil, fmt.Errorf("Couldn't write migrated config back to `%s`: %s", path, err)
return nil, fmt.Errorf("While attempting to write back fixed user config to %s, an error occurred: %s", path, err)
}
fmt.Printf("Success. New config written to %s\n", path)
return changedContent, nil
}