@@ -34,7 +34,7 @@ func PlatformUninstall(ctx context.Context, req *rpc.PlatformUninstallReq) (*rpc
34
34
version , err := semver .Parse (req .Version )
35
35
if err != nil {
36
36
formatter .PrintError (err , "version not readable" )
37
- return fmt .Errorf ("version not readable" , err )
37
+ return nil , fmt .Errorf ("version not readable" , err )
38
38
}
39
39
ref := & packagemanager.PlatformReference {
40
40
Package : req .PlatformPackage ,
@@ -45,13 +45,13 @@ func PlatformUninstall(ctx context.Context, req *rpc.PlatformUninstallReq) (*rpc
45
45
platform := pm .FindPlatform (ref )
46
46
if platform == nil {
47
47
formatter .PrintErrorMessage ("Platform not found " + ref .String ())
48
- return fmt .Errorf ("Platform not found " + ref .String (), err )
48
+ return nil , fmt .Errorf ("Platform not found " + ref .String (), err )
49
49
50
50
}
51
51
platformRelease := pm .GetInstalledPlatformRelease (platform )
52
52
if platformRelease == nil {
53
53
formatter .PrintErrorMessage ("Platform not installed " + ref .String ())
54
- return fmt .Errorf ("Platform not installed " + ref .String (), err )
54
+ return nil , fmt .Errorf ("Platform not installed " + ref .String (), err )
55
55
56
56
}
57
57
ref .PlatformVersion = platformRelease .Version
@@ -60,11 +60,15 @@ func PlatformUninstall(ctx context.Context, req *rpc.PlatformUninstallReq) (*rpc
60
60
platform , tools , err := pm .FindPlatformReleaseDependencies (ref )
61
61
if err != nil {
62
62
formatter .PrintError (err , "Could not determine platform dependencies" )
63
- return fmt .Errorf ("Could not determine platform dependencies" , err )
63
+ return nil , fmt .Errorf ("Could not determine platform dependencies" , err )
64
64
65
65
}
66
66
67
- uninstallPlatformRelease (pm , platform )
67
+ err = uninstallPlatformRelease (pm , platform )
68
+ if err != nil {
69
+ formatter .PrintError (err , "Error uninstalling " + platform .String ())
70
+ return nil , err
71
+ }
68
72
69
73
for _ , tool := range tools {
70
74
if ! pm .IsToolRequired (tool ) {
@@ -75,7 +79,7 @@ func PlatformUninstall(ctx context.Context, req *rpc.PlatformUninstallReq) (*rpc
75
79
return & rpc.PlatformUninstallResp {}, nil
76
80
}
77
81
78
- func uninstallPlatformRelease (pm * packagemanager.PackageManager , platformRelease * cores.PlatformRelease ) {
82
+ func uninstallPlatformRelease (pm * packagemanager.PackageManager , platformRelease * cores.PlatformRelease ) error {
79
83
log := pm .Log .WithField ("platform" , platformRelease )
80
84
81
85
log .Info ("Uninstalling platform" )
@@ -89,9 +93,10 @@ func uninstallPlatformRelease(pm *packagemanager.PackageManager, platformRelease
89
93
90
94
log .Info ("Platform uninstalled" )
91
95
formatter .Print (platformRelease .String () + " uninstalled" )
96
+ return nil
92
97
}
93
98
94
- func uninstallToolRelease (pm * packagemanager.PackageManager , toolRelease * cores.ToolRelease ) {
99
+ func uninstallToolRelease (pm * packagemanager.PackageManager , toolRelease * cores.ToolRelease ) error {
95
100
log := pm .Log .WithField ("Tool" , toolRelease )
96
101
97
102
log .Info ("Uninstalling tool" )
@@ -105,4 +110,5 @@ func uninstallToolRelease(pm *packagemanager.PackageManager, toolRelease *cores.
105
110
106
111
log .Info ("Tool uninstalled" )
107
112
formatter .Print (toolRelease .String () + " uninstalled" )
113
+ return nil
108
114
}
0 commit comments