Skip to content

Commit bb5f8cd

Browse files
committed
Inlined gRPC methods to implement GetDebugConfig and IsDebugSupported
1 parent eb28638 commit bb5f8cd

File tree

4 files changed

+4
-16
lines changed

4 files changed

+4
-16
lines changed

commands/service_debug.go

-11
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package commands
1717

1818
import (
19-
"context"
2019
"errors"
2120
"os"
2221

@@ -64,13 +63,3 @@ func (s *arduinoCoreServerImpl) Debug(stream rpc.ArduinoCoreService_DebugServer)
6463
}
6564
return stream.Send(resp)
6665
}
67-
68-
// GetDebugConfig return metadata about a debug session
69-
func (s *arduinoCoreServerImpl) GetDebugConfig(ctx context.Context, req *rpc.GetDebugConfigRequest) (*rpc.GetDebugConfigResponse, error) {
70-
return GetDebugConfig(ctx, req)
71-
}
72-
73-
// IsDebugSupported checks if debugging is supported for a given configuration
74-
func (s *arduinoCoreServerImpl) IsDebugSupported(ctx context.Context, req *rpc.IsDebugSupportedRequest) (*rpc.IsDebugSupportedResponse, error) {
75-
return IsDebugSupported(ctx, req)
76-
}

commands/service_debug_config.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import (
3838
)
3939

4040
// GetDebugConfig returns metadata to start debugging with the specified board
41-
func GetDebugConfig(ctx context.Context, req *rpc.GetDebugConfigRequest) (*rpc.GetDebugConfigResponse, error) {
41+
func (s *arduinoCoreServerImpl) GetDebugConfig(ctx context.Context, req *rpc.GetDebugConfigRequest) (*rpc.GetDebugConfigResponse, error) {
4242
pme, release, err := instances.GetPackageManagerExplorer(req.GetInstance())
4343
if err != nil {
4444
return nil, err
@@ -48,7 +48,7 @@ func GetDebugConfig(ctx context.Context, req *rpc.GetDebugConfigRequest) (*rpc.G
4848
}
4949

5050
// IsDebugSupported checks if the given board/programmer configuration supports debugging.
51-
func IsDebugSupported(ctx context.Context, req *rpc.IsDebugSupportedRequest) (*rpc.IsDebugSupportedResponse, error) {
51+
func (s *arduinoCoreServerImpl) IsDebugSupported(ctx context.Context, req *rpc.IsDebugSupportedRequest) (*rpc.IsDebugSupportedResponse, error) {
5252
pme, release, err := instances.GetPackageManagerExplorer(req.GetInstance())
5353
if err != nil {
5454
return nil, err

internal/cli/debug/debug.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func runDebugCommand(ctx context.Context, srv rpc.ArduinoCoreServiceServer, args
122122

123123
if printInfo {
124124

125-
if res, err := commands.GetDebugConfig(ctx, debugConfigRequested); err != nil {
125+
if res, err := srv.GetDebugConfig(ctx, debugConfigRequested); err != nil {
126126
errcode := feedback.ErrBadArgument
127127
if errors.Is(err, &cmderrors.MissingProgrammerError{}) {
128128
errcode = feedback.ErrMissingProgrammer

internal/cli/debug/debug_check.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"context"
2020
"os"
2121

22-
"github.com/arduino/arduino-cli/commands"
2322
"github.com/arduino/arduino-cli/internal/cli/arguments"
2423
"github.com/arduino/arduino-cli/internal/cli/feedback"
2524
"github.com/arduino/arduino-cli/internal/cli/feedback/result"
@@ -61,7 +60,7 @@ func runDebugCheckCommand(ctx context.Context, srv rpc.ArduinoCoreServiceServer,
6160
feedback.FatalError(err, feedback.ErrBadArgument)
6261
}
6362
fqbn := fqbnArg.String()
64-
resp, err := commands.IsDebugSupported(ctx, &rpc.IsDebugSupportedRequest{
63+
resp, err := srv.IsDebugSupported(ctx, &rpc.IsDebugSupportedRequest{
6564
Instance: instance,
6665
Fqbn: fqbn,
6766
Port: port,

0 commit comments

Comments
 (0)