Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: per1234 <accounts@perglass.com>
  • Loading branch information
cmaglie and per1234 authored Aug 16, 2023
1 parent e9e5fbd commit 69d9ae7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion arduino/discovery/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type Port struct {

var tr = i18n.Tr

// Equals return true if the given port has the same address and protocol
// Equals returns true if the given port has the same address and protocol
// of the current port.
func (p *Port) Equals(o *Port) bool {
return p.Address == o.Address && p.Protocol == o.Protocol
Expand Down
6 changes: 3 additions & 3 deletions commands/upload/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ func detectUploadPort(
return
}
if candidate != nil && ev.Type == "remove" && ev.Port.Equals(candidate) {
log.WithField("event", ev).Trace("User-specified port has been disconnected, forcing waiting for upload port")
log.WithField("event", ev).Trace("User-specified port has been disconnected, forcing wait for upload port")
waitForUploadPort = true
candidate = nil
} else {
Expand All @@ -565,12 +565,12 @@ func detectUploadPort(
return
}
if candidate != nil && ev.Type == "remove" && candidate.Equals(ev.Port) {
log.WithField("event", ev).Trace("Candidate port is no more available")
log.WithField("event", ev).Trace("Candidate port is no longer available")
candidate = nil
if !waitForUploadPort {
waitForUploadPort = true
timeout = time.After(5 * time.Second)
log.Trace("User-specified port has been disconnected, now waiting for upload port, timeout exteneded by 5 seconds")
log.Trace("User-specified port has been disconnected, now waiting for upload port, timeout extended by 5 seconds")
}
continue
}
Expand Down
2 changes: 1 addition & 1 deletion internal/algorithms/channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package f

import "sync"

// DiscardCh consume all incoming messages from the given channel until its closed.
// DiscardCh consumes all incoming messages from the given channel until it's closed.
func DiscardCh[T any](ch <-chan T) {
for range ch {
}
Expand Down

0 comments on commit 69d9ae7

Please sign in to comment.