Skip to content

[skip-changelog] Remove empty object from the output of grpc commands #2057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 7 additions & 28 deletions commands/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,7 @@ func (s *ArduinoCoreServerImpl) UpdateLibrariesIndex(req *rpc.UpdateLibrariesInd
err := commands.UpdateLibrariesIndex(stream.Context(), req,
func(p *rpc.DownloadProgress) { stream.Send(&rpc.UpdateLibrariesIndexResponse{DownloadProgress: p}) },
)
if err != nil {
return convertErrorToRPCStatus(err)
}
return stream.Send(&rpc.UpdateLibrariesIndexResponse{})
return convertErrorToRPCStatus(err)
}

// Create FIXMEDOC
Expand Down Expand Up @@ -357,10 +354,7 @@ func (s *ArduinoCoreServerImpl) LibraryInstall(req *rpc.LibraryInstallRequest, s
func(p *rpc.DownloadProgress) { stream.Send(&rpc.LibraryInstallResponse{Progress: p}) },
func(p *rpc.TaskProgress) { stream.Send(&rpc.LibraryInstallResponse{TaskProgress: p}) },
)
if err != nil {
return convertErrorToRPCStatus(err)
}
return stream.Send(&rpc.LibraryInstallResponse{})
return convertErrorToRPCStatus(err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can a similar approach be applied to other stream.Send()? Like the return at the end of the PlatformInstall command above.
Also I think we should also add some test to avoid regression

}

// LibraryUpgrade FIXMEDOC
Expand All @@ -370,21 +364,15 @@ func (s *ArduinoCoreServerImpl) LibraryUpgrade(req *rpc.LibraryUpgradeRequest, s
func(p *rpc.DownloadProgress) { stream.Send(&rpc.LibraryUpgradeResponse{Progress: p}) },
func(p *rpc.TaskProgress) { stream.Send(&rpc.LibraryUpgradeResponse{TaskProgress: p}) },
)
if err != nil {
return convertErrorToRPCStatus(err)
}
return stream.Send(&rpc.LibraryUpgradeResponse{})
return convertErrorToRPCStatus(err)
}

// LibraryUninstall FIXMEDOC
func (s *ArduinoCoreServerImpl) LibraryUninstall(req *rpc.LibraryUninstallRequest, stream rpc.ArduinoCoreService_LibraryUninstallServer) error {
err := lib.LibraryUninstall(stream.Context(), req,
func(p *rpc.TaskProgress) { stream.Send(&rpc.LibraryUninstallResponse{TaskProgress: p}) },
)
if err != nil {
return convertErrorToRPCStatus(err)
}
return stream.Send(&rpc.LibraryUninstallResponse{})
return convertErrorToRPCStatus(err)
}

// LibraryUpgradeAll FIXMEDOC
Expand All @@ -393,10 +381,7 @@ func (s *ArduinoCoreServerImpl) LibraryUpgradeAll(req *rpc.LibraryUpgradeAllRequ
func(p *rpc.DownloadProgress) { stream.Send(&rpc.LibraryUpgradeAllResponse{Progress: p}) },
func(p *rpc.TaskProgress) { stream.Send(&rpc.LibraryUpgradeAllResponse{TaskProgress: p}) },
)
if err != nil {
return convertErrorToRPCStatus(err)
}
return stream.Send(&rpc.LibraryUpgradeAllResponse{})
return convertErrorToRPCStatus(err)
}

// LibraryResolveDependencies FIXMEDOC
Expand Down Expand Up @@ -429,10 +414,7 @@ func (s *ArduinoCoreServerImpl) ZipLibraryInstall(req *rpc.ZipLibraryInstallRequ
stream.Context(), req,
func(p *rpc.TaskProgress) { stream.Send(&rpc.ZipLibraryInstallResponse{TaskProgress: p}) },
)
if err != nil {
return convertErrorToRPCStatus(err)
}
return stream.Send(&rpc.ZipLibraryInstallResponse{})
return convertErrorToRPCStatus(err)
}

// GitLibraryInstall FIXMEDOC
Expand All @@ -441,10 +423,7 @@ func (s *ArduinoCoreServerImpl) GitLibraryInstall(req *rpc.GitLibraryInstallRequ
stream.Context(), req,
func(p *rpc.TaskProgress) { stream.Send(&rpc.GitLibraryInstallResponse{TaskProgress: p}) },
)
if err != nil {
return convertErrorToRPCStatus(err)
}
return stream.Send(&rpc.GitLibraryInstallResponse{})
return convertErrorToRPCStatus(err)
}

// EnumerateMonitorPortSettings FIXMEDOC
Expand Down