Skip to content

Commit 992bb50

Browse files
committed
make linter happy
1 parent efabea3 commit 992bb50

File tree

5 files changed

+32
-3
lines changed

5 files changed

+32
-3
lines changed

args/args.go

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
// a commercial license, send an email to license@arduino.cc.
1616
//
1717

18+
// Package args provides functionality to parse command-line arguments.
19+
// It includes a function to parse arguments passed by the user and a variable to check if the version flag is set.
20+
// The package also handles invalid arguments by printing an error message and exiting the program.
1821
package args
1922

2023
import (

main.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// a commercial license, send an email to license@arduino.cc.
1616
//
1717

18+
// Package main implements the serial discovery
1819
package main
1920

2021
import (
@@ -48,6 +49,7 @@ type SerialDiscovery struct {
4849
}
4950

5051
// Hello is the handler for the pluggable-discovery HELLO command
52+
// revive:disable:unused-parameter
5153
func (d *SerialDiscovery) Hello(userAgent string, protocolVersion int) error {
5254
return nil
5355
}
@@ -68,10 +70,10 @@ func (d *SerialDiscovery) Stop() error {
6870

6971
// StartSync is the handler for the pluggable-discovery START_SYNC command
7072
func (d *SerialDiscovery) StartSync(eventCB discovery.EventCallback, errorCB discovery.ErrorCallback) error {
71-
close, err := sync.Start(eventCB, errorCB)
73+
done, err := sync.Start(eventCB, errorCB)
7274
if err != nil {
7375
return err
7476
}
75-
d.closeChan = close
77+
d.closeChan = done
7678
return nil
7779
}

sync/sync.go

+15
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@
1515
// a commercial license, send an email to license@arduino.cc.
1616
//
1717

18+
// Package sync provides functions for synchronizing and processing updates
19+
// related to serial port discovery.
20+
//
21+
// This package includes functions for comparing two lists of serial ports and
22+
// sending 'add' and 'remove' events based on the differences between the lists.
23+
// It also includes utility functions for converting port details to the discovery
24+
// protocol format.
25+
//
26+
// The main function in this package is `processUpdates`, which takes in two lists
27+
// of serial port details and an event callback function. It compares the two lists
28+
// and sends 'add' and 'remove' events based on the differences. The `portListHas`
29+
// function is used to check if a port is contained in a list, and the `toDiscoveryPort`
30+
// function is used to convert port details to the discovery protocol format.
1831
package sync
1932

2033
import (
@@ -23,6 +36,7 @@ import (
2336
"go.bug.st/serial/enumerator"
2437
)
2538

39+
// nolint
2640
// processUpdates sends 'add' and 'remove' events by comparing two ports enumeration
2741
// made at different times:
2842
// - ports present in the new list but not in the old list are reported as 'added'
@@ -44,6 +58,7 @@ func processUpdates(old, new []*enumerator.PortDetails, eventCB discovery.EventC
4458
}
4559
}
4660

61+
// nolint
4762
// portListHas checks if port is contained in list. The port metadata are
4863
// compared in particular the port address, and vid/pid if the port is a usb port.
4964
func portListHas(list []*enumerator.PortDetails, port *enumerator.PortDetails) bool {

sync/sync_linux.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ func Start(eventCB discovery.EventCallback, errorCB discovery.ErrorCallback) (ch
4545
closeChan := make(chan bool)
4646
go func() {
4747
<-closeChan
48-
syncReader.Close()
48+
err := syncReader.Close()
49+
if err != nil {
50+
errorCB(fmt.Sprintf("Error closing sync reader: %s", err))
51+
}
4952
}()
5053

5154
// Run synchronous event emitter

version/version.go

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
// a commercial license, send an email to license@arduino.cc.
1616
//
1717

18+
// Package version provides information about the version of the application.
19+
// It includes the version string, commit hash, and timestamp.
20+
// The package also defines a struct `Info` that represents the version information.
21+
// The `newInfo` function creates a new `Info` instance with the provided application name.
22+
// The `String` method of the `Info` struct returns a formatted string representation of the version information.
23+
// The package also initializes the `Version` variable with a default version string if it is empty.
1824
package version
1925

2026
import (

0 commit comments

Comments
 (0)