Skip to content

Commit

Permalink
fix (again) go vet failing, followup of #668 and #693
Browse files Browse the repository at this point in the history
  • Loading branch information
umbynos committed Feb 23, 2022
1 parent 75b42b9 commit dbfbb1b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions serial.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type serialhub struct {
type SpPortList struct {
Ports []SpPortItem
Network bool
mu sync.Mutex `json:"-"`
Mu sync.Mutex `json:"-"`
}

type SpPortItem struct {
Expand Down Expand Up @@ -113,13 +113,13 @@ func spList(network bool) {
var ls []byte
var err error
if network {
NetworkPorts.mu.Lock()
NetworkPorts.Mu.Lock()
ls, err = json.MarshalIndent(&NetworkPorts, "", "\t")
NetworkPorts.mu.Unlock()
NetworkPorts.Mu.Unlock()
} else {
SerialPorts.mu.Lock()
SerialPorts.Mu.Lock()
ls, err = json.MarshalIndent(&SerialPorts, "", "\t")
SerialPorts.mu.Unlock()
SerialPorts.Mu.Unlock()
}
if err != nil {
//log.Println(err)
Expand All @@ -132,14 +132,14 @@ func spList(network bool) {

// discoverLoop periodically update the list of ports found
func discoverLoop() {
SerialPorts.mu.Lock()
SerialPorts.Mu.Lock()
SerialPorts.Network = false
SerialPorts.Ports = make([]SpPortItem, 0)
SerialPorts.mu.Unlock()
NetworkPorts.mu.Lock()
SerialPorts.Mu.Unlock()
NetworkPorts.Mu.Lock()
NetworkPorts.Network = true
NetworkPorts.Ports = make([]SpPortItem, 0)
NetworkPorts.mu.Unlock()
NetworkPorts.Mu.Unlock()

go func() {
for {
Expand Down Expand Up @@ -233,13 +233,13 @@ func spListDual(network bool) {
}

if network {
NetworkPorts.mu.Lock()
NetworkPorts.Mu.Lock()
NetworkPorts.Ports = spl
NetworkPorts.mu.Unlock()
NetworkPorts.Mu.Unlock()
} else {
SerialPorts.mu.Lock()
SerialPorts.Mu.Lock()
SerialPorts.Ports = spl
SerialPorts.mu.Unlock()
SerialPorts.Mu.Unlock()
}
}

Expand Down

0 comments on commit dbfbb1b

Please sign in to comment.