Skip to content

Commit 150eff5

Browse files
committed
Use 4-digit uint instead
Signed-off-by: Furkan <[email protected]>
1 parent 1ab0de2 commit 150eff5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

net_wireless.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ import (
2828
type Wireless struct {
2929
Name string
3030

31-
// Status is the current status of the interface.
32-
Status int
31+
// Status is the current 4-digit hex value status of the interface.
32+
Status uint64
3333

3434
// QualityLink is the link quality.
3535
QualityLink int
@@ -107,7 +107,7 @@ func parseWireless(r io.Reader) ([]*Wireless, error) {
107107
return nil, fmt.Errorf("invalid number of fields in line %d, expected at least 10, got %d: %q", n, len(stats), line)
108108
}
109109

110-
status, err := strconv.Atoi(stats[0])
110+
status, err := strconv.ParseUint(stats[0], 16, 16)
111111
if err != nil {
112112
return nil, fmt.Errorf("invalid status in line %d: %q", n, line)
113113
}

net_wireless_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ func TestWireless(t *testing.T) {
4545
},
4646
{
4747
Name: "wlan1",
48-
Status: 10,
48+
Status: 16,
4949
QualityLink: 9,
5050
QualityLevel: 8,
5151
QualityNoise: 7,

0 commit comments

Comments
 (0)