Skip to content

Commit 4bcaf9c

Browse files
cmagliesilvanocerza
andcommitted
Apply changes from code review
Co-authored-by: Silvano Cerza <[email protected]>
1 parent 89a61df commit 4bcaf9c

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Diff for: cli/lib/check_deps.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ func runDepsCommand(cmd *cobra.Command, args []string) {
5151
os.Exit(errorcodes.ErrBadArgument)
5252
}
5353

54-
deps, stat := lib.LibraryResolveDependencies(context.Background(), &rpc.LibraryResolveDependenciesRequest{
54+
deps, err := lib.LibraryResolveDependencies(context.Background(), &rpc.LibraryResolveDependenciesRequest{
5555
Instance: instance,
5656
Name: libRef.Name,
5757
Version: libRef.Version,
5858
})
59-
if stat != nil {
59+
if err != nil {
6060
feedback.Errorf(tr("Error resolving dependencies for %[1]s: %[2]s", libRef, err))
6161
}
6262

Diff for: commands/board/list.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,10 @@ func List(req *rpc.BoardListRequest) (r []*rpc.DetectedPort, e error) {
187187

188188
dm := pm.DiscoveryManager()
189189
if errs := dm.RunAll(); len(errs) > 0 {
190-
return nil, &commands.UnavailableError{Message: tr("Error starting board discoveries"), Cause: errs[0]}
190+
return nil, &commands.UnavailableError{Message: tr("Error starting board discoveries"), Cause: fmt.Errorf("%v", errs)}
191191
}
192192
if errs := dm.StartAll(); len(errs) > 0 {
193-
return nil, &commands.UnavailableError{Message: tr("Error starting board discoveries"), Cause: errs[0]}
193+
return nil, &commands.UnavailableError{Message: tr("Error starting board discoveries"), Cause: fmt.Errorf("%v", errs)}
194194
}
195195
defer func() {
196196
if errs := dm.StopAll(); len(errs) > 0 {
@@ -202,7 +202,7 @@ func List(req *rpc.BoardListRequest) (r []*rpc.DetectedPort, e error) {
202202
retVal := []*rpc.DetectedPort{}
203203
ports, errs := pm.DiscoveryManager().List()
204204
if len(errs) > 0 {
205-
return nil, &commands.UnavailableError{Message: tr("Error getting board list"), Cause: errs[0]}
205+
return nil, &commands.UnavailableError{Message: tr("Error getting board list"), Cause: fmt.Errorf("%v", errs)}
206206
}
207207
for _, port := range ports {
208208
boards, err := identify(pm, port)
@@ -231,7 +231,7 @@ func Watch(instanceID int32, interrupt <-chan bool) (<-chan *rpc.BoardListWatchR
231231
runErrs := dm.RunAll()
232232
if len(runErrs) == len(dm.IDs()) {
233233
// All discoveries failed to run, we can't do anything
234-
return nil, &commands.UnavailableError{Message: tr("Error starting board discoveries"), Cause: runErrs[0]}
234+
return nil, &commands.UnavailableError{Message: tr("Error starting board discoveries"), Cause: fmt.Errorf("%v", runErrs)}
235235
}
236236

237237
eventsChan, errs := dm.StartSyncAll()

Diff for: commands/upload/upload.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ func runProgramAction(pm *packagemanager.PackageManager,
237237
} else if programmer != nil {
238238
action = "program"
239239
}
240-
uploadToolID, st := getToolID(props, action, port.Protocol)
241-
if st != nil {
242-
return st
240+
uploadToolID, err := getToolID(props, action, port.Protocol)
241+
if err != nil {
242+
return err
243243
}
244244

245245
var uploadToolPlatform *cores.PlatformRelease

Diff for: commands/upload/upload_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func TestUploadPropertiesComposition(t *testing.T) {
180180
testRunner := func(t *testing.T, test test, verboseVerify bool) {
181181
outStream := &bytes.Buffer{}
182182
errStream := &bytes.Buffer{}
183-
status := runProgramAction(
183+
err := runProgramAction(
184184
pm,
185185
nil, // sketch
186186
"", // importFile
@@ -201,9 +201,9 @@ func TestUploadPropertiesComposition(t *testing.T) {
201201
verboseVerifyOutput = "quiet noverify"
202202
}
203203
if test.expectedOutput == "FAIL" {
204-
require.NotNil(t, status)
204+
require.NotNil(t, err)
205205
} else {
206-
require.Nil(t, status)
206+
require.Nil(t, err)
207207
outFiltered := strings.ReplaceAll(outStream.String(), "\r", "")
208208
outFiltered = strings.ReplaceAll(outFiltered, "\\", "/")
209209
require.Contains(t, outFiltered, strings.ReplaceAll(test.expectedOutput, "$$VERBOSE-VERIFY$$", verboseVerifyOutput))

0 commit comments

Comments
 (0)