Skip to content

Commit df28c7c

Browse files
cmaglieper1234
andcommitted
Apply suggestions from code review
Co-authored-by: per1234 <[email protected]>
1 parent 04e70c5 commit df28c7c

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

Diff for: arduino/cores/packagemanager/package_manager.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type PackageManager struct {
5454
}
5555

5656
// Builder is used to create a new PackageManager. The builder
57-
// has methods to load patforms and tools to actually build the PackageManager.
57+
// has methods to load platforms and tools to actually build the PackageManager.
5858
// Once the PackageManager is built, it cannot be changed anymore.
5959
type Builder PackageManager
6060

@@ -82,19 +82,19 @@ func NewBuilder(indexDir, packagesDir, downloadDir, tempDir *paths.Path, userAge
8282

8383
// BuildIntoExistingPackageManager will overwrite the given PackageManager instead
8484
// of building a new one.
85-
func (pmb *Builder) BuildIntoExistingPackageManager(old *PackageManager) {
86-
old.packagesLock.Lock()
87-
defer old.packagesLock.Unlock()
88-
old.log = pmb.log
89-
old.packages = pmb.packages
90-
old.IndexDir = pmb.IndexDir
91-
old.PackagesDir = pmb.PackagesDir
92-
old.DownloadDir = pmb.DownloadDir
93-
old.tempDir = pmb.tempDir
94-
old.packagesCustomGlobalProperties = pmb.packagesCustomGlobalProperties
95-
old.profile = pmb.profile
96-
old.discoveryManager = pmb.discoveryManager
97-
old.userAgent = pmb.userAgent
85+
func (pmb *Builder) BuildIntoExistingPackageManager(target *PackageManager) {
86+
target.packagesLock.Lock()
87+
defer target.packagesLock.Unlock()
88+
target.log = pmb.log
89+
target.packages = pmb.packages
90+
target.IndexDir = pmb.IndexDir
91+
target.PackagesDir = pmb.PackagesDir
92+
target.DownloadDir = pmb.DownloadDir
93+
target.tempDir = pmb.tempDir
94+
target.packagesCustomGlobalProperties = pmb.packagesCustomGlobalProperties
95+
target.profile = pmb.profile
96+
target.discoveryManager = pmb.discoveryManager
97+
target.userAgent = pmb.userAgent
9898
}
9999

100100
// Build builds a new PackageManager.

Diff for: commands/instances.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (c *coreInstancesContainer) GetInstance(id int32) *CoreInstance {
7575
return c.instances[id]
7676
}
7777

78-
// AddAndAssignID saves the CoreInstance and assign an unique ID to
78+
// AddAndAssignID saves the CoreInstance and assigns a unique ID to
7979
// retrieve it later
8080
func (c *coreInstancesContainer) AddAndAssignID(i *CoreInstance) int32 {
8181
c.instancesMux.Lock()
@@ -86,9 +86,9 @@ func (c *coreInstancesContainer) AddAndAssignID(i *CoreInstance) int32 {
8686
return id
8787
}
8888

89-
// RemoveID removed the CoreInstance referenced by id. Returns true
89+
// RemoveID removes the CoreInstance referenced by id. Returns true
9090
// if the operation is successful, or false if the CoreInstance does
91-
// not exists
91+
// not exist
9292
func (c *coreInstancesContainer) RemoveID(id int32) bool {
9393
c.instancesMux.Lock()
9494
defer c.instancesMux.Unlock()

Diff for: docs/UPGRADING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func LibraryUpgrade(instanceID int32, libraryNames []string, downloadCB rpc.Down
232232
have been changed to:
233233

234234
```go
235-
func Watch(req *rpc.BoardListWatchRequest) (<-chan *rpc.BoardListWatchResponse, func(), error) { ... ]
235+
func Watch(req *rpc.BoardListWatchRequest) (<-chan *rpc.BoardListWatchResponse, func(), error) { ... }
236236
func LibraryUpgradeAll(req *rpc.LibraryUpgradeAllRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { ... }
237237
func LibraryUpgrade(ctx context.Context, req *rpc.LibraryUpgradeRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { ... }
238238
```
@@ -249,12 +249,12 @@ have been changed to:
249249

250250
```go
251251
func GetPackageManager(instance rpc.InstanceCommand) *packagemanager.PackageManager { ... } // Deprecated
252-
func GetPackageManagerExplorer(req rpc.InstanceCommand) (explorer *packagemanager.Explorer, release func()) { ... ]
252+
func GetPackageManagerExplorer(req rpc.InstanceCommand) (explorer *packagemanager.Explorer, release func()) { ... }
253253
func GetLibraryManager(req rpc.InstanceCommand) *librariesmanager.LibrariesManager { ... }
254254
```
255255

256-
Old code using passing the `instanceID` inside the gRPC request must be changed to pass directly the whole gRPC request,
257-
for example:
256+
Old code passing the `instanceID` inside the gRPC request must be changed to pass directly the whole gRPC request, for
257+
example:
258258

259259
```go
260260
eventsChan, closeWatcher, err := board.Watch(req.Instance.Id)

Diff for: rpc/cc/arduino/cli/commands/v1/common.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type DownloadProgressCB func(curr *DownloadProgress)
2121
// TaskProgressCB is a callback to receive progress messages
2222
type TaskProgressCB func(msg *TaskProgress)
2323

24-
// InstanceCommand is an interface thar represents a gRPC command with
24+
// InstanceCommand is an interface that represents a gRPC command with
2525
// a gRPC Instance.
2626
type InstanceCommand interface {
2727
GetInstance() *Instance

0 commit comments

Comments
 (0)