diff --git a/commands/service_board_listall.go b/commands/service_board_listall.go index 5c9a8664ab3..93df1f4e338 100644 --- a/commands/service_board_listall.go +++ b/commands/service_board_listall.go @@ -46,8 +46,8 @@ func (s *arduinoCoreServerImpl) BoardListAll(ctx context.Context, req *rpc.Board } rpcPlatform := &rpc.Platform{ - Metadata: PlatformToRPCPlatformMetadata(platform), - Release: PlatformReleaseToRPC(installedPlatformRelease), + Metadata: platformToRPCPlatformMetadata(platform), + Release: platformReleaseToRPC(installedPlatformRelease), } toTest := []string{ diff --git a/commands/service_board_search.go b/commands/service_board_search.go index a3714b669c2..bbe4ca22529 100644 --- a/commands/service_board_search.go +++ b/commands/service_board_search.go @@ -67,8 +67,8 @@ func (s *arduinoCoreServerImpl) BoardSearch(ctx context.Context, req *rpc.BoardS Fqbn: board.FQBN(), IsHidden: board.IsHidden(), Platform: &rpc.Platform{ - Metadata: PlatformToRPCPlatformMetadata(platform), - Release: PlatformReleaseToRPC(installedPlatformRelease), + Metadata: platformToRPCPlatformMetadata(platform), + Release: platformReleaseToRPC(installedPlatformRelease), }, }) } @@ -82,8 +82,8 @@ func (s *arduinoCoreServerImpl) BoardSearch(ctx context.Context, req *rpc.BoardS foundBoards = append(foundBoards, &rpc.BoardListItem{ Name: strings.Trim(board.Name, " \n"), Platform: &rpc.Platform{ - Metadata: PlatformToRPCPlatformMetadata(platform), - Release: PlatformReleaseToRPC(latestPlatformRelease), + Metadata: platformToRPCPlatformMetadata(platform), + Release: platformReleaseToRPC(latestPlatformRelease), }, }) } diff --git a/commands/service_library_download.go b/commands/service_library_download.go index 152afa466ba..37b4ecbb53e 100644 --- a/commands/service_library_download.go +++ b/commands/service_library_download.go @@ -56,7 +56,7 @@ func (s *arduinoCoreServerImpl) LibraryDownload(req *rpc.LibraryDownloadRequest, return err } - version, err := ParseVersion(req.GetVersion()) + version, err := parseVersion(req.GetVersion()) if err != nil { return err } diff --git a/commands/service_library_install.go b/commands/service_library_install.go index c2b9aa7ad1e..d4440d3d2ae 100644 --- a/commands/service_library_install.go +++ b/commands/service_library_install.go @@ -109,7 +109,7 @@ func (s *arduinoCoreServerImpl) LibraryInstall(req *rpc.LibraryInstallRequest, s libReleasesToInstall := map[*librariesindex.Release]*librariesmanager.LibraryInstallPlan{} installLocation := libraries.FromRPCLibraryInstallLocation(req.GetInstallLocation()) for _, lib := range toInstall { - version, err := ParseVersion(lib.GetVersionRequired()) + version, err := parseVersion(lib.GetVersionRequired()) if err != nil { return err } diff --git a/commands/service_library_resolve_deps.go b/commands/service_library_resolve_deps.go index 013199dbe29..c50cc2d9f6a 100644 --- a/commands/service_library_resolve_deps.go +++ b/commands/service_library_resolve_deps.go @@ -47,7 +47,7 @@ func (s *arduinoCoreServerImpl) LibraryResolveDependencies(ctx context.Context, func libraryResolveDependencies(lme *librariesmanager.Explorer, li *librariesindex.Index, reqName, reqVersion string, noOverwrite bool) (*rpc.LibraryResolveDependenciesResponse, error) { - version, err := ParseVersion(reqVersion) + version, err := parseVersion(reqVersion) if err != nil { return nil, err } diff --git a/commands/service_library_uninstall.go b/commands/service_library_uninstall.go index e436cbe15a9..8164427f139 100644 --- a/commands/service_library_uninstall.go +++ b/commands/service_library_uninstall.go @@ -47,7 +47,7 @@ func (s *arduinoCoreServerImpl) LibraryUninstall(req *rpc.LibraryUninstallReques return err } - version, err := ParseVersion(req.GetVersion()) + version, err := parseVersion(req.GetVersion()) if err != nil { return err } diff --git a/commands/service_platform_download.go b/commands/service_platform_download.go index a4227fa30b9..23a8096120d 100644 --- a/commands/service_platform_download.go +++ b/commands/service_platform_download.go @@ -48,7 +48,7 @@ func (s *arduinoCoreServerImpl) PlatformDownload(req *rpc.PlatformDownloadReques } defer release() - version, err := ParseVersion(req.GetVersion()) + version, err := parseVersion(req.GetVersion()) if err != nil { return &cmderrors.InvalidVersionError{Cause: err} } diff --git a/commands/service_platform_install.go b/commands/service_platform_install.go index 06c8891fcc3..caa351a6ec6 100644 --- a/commands/service_platform_install.go +++ b/commands/service_platform_install.go @@ -53,7 +53,7 @@ func (s *arduinoCoreServerImpl) PlatformInstall(req *rpc.PlatformInstallRequest, } defer release() - version, err := ParseVersion(req.GetVersion()) + version, err := parseVersion(req.GetVersion()) if err != nil { return &cmderrors.InvalidVersionError{Cause: err} } diff --git a/commands/service_platform_search.go b/commands/service_platform_search.go index dfa0d33ffd8..4117bf7be18 100644 --- a/commands/service_platform_search.go +++ b/commands/service_platform_search.go @@ -82,7 +82,7 @@ func (s *arduinoCoreServerImpl) PlatformSearch(_ context.Context, req *rpc.Platf out := []*rpc.PlatformSummary{} for _, platform := range res { rpcPlatformSummary := &rpc.PlatformSummary{ - Metadata: PlatformToRPCPlatformMetadata(platform), + Metadata: platformToRPCPlatformMetadata(platform), Releases: map[string]*rpc.PlatformRelease{}, } if installed := pme.GetInstalledPlatformRelease(platform); installed != nil { @@ -92,7 +92,7 @@ func (s *arduinoCoreServerImpl) PlatformSearch(_ context.Context, req *rpc.Platf rpcPlatformSummary.LatestVersion = latestCompatible.Version.String() } for _, platformRelease := range platform.GetAllReleases() { - rpcPlatformRelease := PlatformReleaseToRPC(platformRelease) + rpcPlatformRelease := platformReleaseToRPC(platformRelease) rpcPlatformSummary.Releases[rpcPlatformRelease.GetVersion()] = rpcPlatformRelease } out = append(out, rpcPlatformSummary) diff --git a/commands/service_platform_upgrade.go b/commands/service_platform_upgrade.go index a9b65fe5bfa..2737eac4f37 100644 --- a/commands/service_platform_upgrade.go +++ b/commands/service_platform_upgrade.go @@ -76,8 +76,8 @@ func (s *arduinoCoreServerImpl) PlatformUpgrade(req *rpc.PlatformUpgradeRequest, if platformRelease != nil { syncSend.Send(&rpc.PlatformUpgradeResponse{ Platform: &rpc.Platform{ - Metadata: PlatformToRPCPlatformMetadata(platformRelease.Platform), - Release: PlatformReleaseToRPC(platformRelease), + Metadata: platformToRPCPlatformMetadata(platformRelease.Platform), + Release: platformReleaseToRPC(platformRelease), }, }) } diff --git a/commands/core.go b/commands/utility_core.go similarity index 91% rename from commands/core.go rename to commands/utility_core.go index e61078da1b2..b5a57ad509d 100644 --- a/commands/core.go +++ b/commands/utility_core.go @@ -20,8 +20,8 @@ import ( rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) -// PlatformToRPCPlatformMetadata converts our internal structure to the RPC structure. -func PlatformToRPCPlatformMetadata(platform *cores.Platform) *rpc.PlatformMetadata { +// platformToRPCPlatformMetadata converts our internal structure to the RPC structure. +func platformToRPCPlatformMetadata(platform *cores.Platform) *rpc.PlatformMetadata { return &rpc.PlatformMetadata{ Id: platform.String(), Maintainer: platform.Package.Maintainer, @@ -33,10 +33,10 @@ func PlatformToRPCPlatformMetadata(platform *cores.Platform) *rpc.PlatformMetada } } -// PlatformReleaseToRPC converts our internal structure to the RPC structure. +// platformReleaseToRPC converts our internal structure to the RPC structure. // Note: this function does not touch the "Installed" field of rpc.Platform as it's not always clear that the // platformRelease we're currently converting is actually installed. -func PlatformReleaseToRPC(platformRelease *cores.PlatformRelease) *rpc.PlatformRelease { +func platformReleaseToRPC(platformRelease *cores.PlatformRelease) *rpc.PlatformRelease { // If the boards are not installed yet, the `platformRelease.Boards` will be a zero length slice. // In such case, we have to use the `platformRelease.BoardsManifest` instead. // So that we can retrieve the name of the boards at least. diff --git a/commands/grpc_streaming_helpers.go b/commands/utility_grpc_streaming.go similarity index 100% rename from commands/grpc_streaming_helpers.go rename to commands/utility_grpc_streaming.go diff --git a/commands/libraries_index_search_matcher.go b/commands/utility_libraries_index_search_matcher.go similarity index 100% rename from commands/libraries_index_search_matcher.go rename to commands/utility_libraries_index_search_matcher.go diff --git a/commands/version.go b/commands/utility_version.go similarity index 89% rename from commands/version.go rename to commands/utility_version.go index 2fd87215a2f..a7232d6fdc4 100644 --- a/commands/version.go +++ b/commands/utility_version.go @@ -20,10 +20,10 @@ import ( semver "go.bug.st/relaxed-semver" ) -// ParseVersion returns the parsed version or nil if the version is +// parseVersion returns the parsed version or nil if the version is // the empty string. An error is returned if the version is not valid // semver. -func ParseVersion(version string) (*semver.Version, error) { +func parseVersion(version string) (*semver.Version, error) { if version == "" { return nil, nil }