Skip to content

Commit

Permalink
style(linux): rename source constants to follow Go conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuar committed Oct 1, 2023
1 parent c231ede commit 657d853
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions internal/linux/appSensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func newActiveAppDetails(app string) *activeAppDetails {
// Cmd: cmd,
// Started: time.UnixMilli(createTime).Format(time.RFC3339),
// Count: len(appProcesses),
DataSource: SOURCE_DBUS,
DataSource: srcDbus,
}
}

Expand All @@ -118,7 +118,7 @@ func newRunningAppsDetails(apps map[string]dbus.Variant) *runningAppsDetails {
details.RunningApps = append(details.RunningApps, appName)
}
}
details.DataSource = SOURCE_DBUS
details.DataSource = srcDbus
return details
}

Expand Down
4 changes: 2 additions & 2 deletions internal/linux/batterySensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (b *upowerBattery) marshalBatteryStateUpdate(ctx context.Context, t sensorT
}{
Voltage: b.getProp(battVoltage).(float64),
Energy: b.getProp(battEnergy).(float64),
DataSource: SOURCE_DBUS,
DataSource: srcDbus,
}
case battPercentage:
fallthrough
Expand All @@ -100,7 +100,7 @@ func (b *upowerBattery) marshalBatteryStateUpdate(ctx context.Context, t sensorT
DataSource string `json:"Data Source"`
}{
Type: stringType(b.getProp(battType).(uint32)),
DataSource: SOURCE_DBUS,
DataSource: srcDbus,
}
}
return state
Expand Down
4 changes: 2 additions & 2 deletions internal/linux/networkConnectionSensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,13 @@ func (s *networkSensor) Attributes() interface{} {
ConnectionType: getConnType(s.objectPath),
Ipv4: getIPAddr(s.objectPath, 4),
Ipv6: getIPAddr(s.objectPath, 6),
DataSource: SOURCE_DBUS,
DataSource: srcDbus,
}
}
return struct {
DataSource string `json:"Data Source"`
}{
DataSource: SOURCE_DBUS,
DataSource: srcDbus,
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/linux/powerSensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func newPowerSensor(t sensorType, g string, v dbus.Variant) *powerSensor {
s.value = strings.Trim(v.String(), "\"")
s.sensorType = t
s.icon = "mdi:flash"
s.source = SOURCE_DBUS
s.source = srcDbus
s.diagnostic = true
return s
}
Expand Down
2 changes: 1 addition & 1 deletion internal/linux/problemsSensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (s *problemsSensor) Attributes() interface{} {
DataSource string `json:"Data Source"`
}{
ProblemList: s.list,
DataSource: SOURCE_DBUS,
DataSource: srcDbus,
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/linux/screenlockSensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func ScreenLockUpdater(ctx context.Context, tracker device.SensorTracker) {
lock := &screenlockSensor{}
lock.value = s.Body[0].(bool)
lock.sensorType = screenLock
lock.source = SOURCE_DBUS
lock.source = srcDbus
tracker.UpdateSensors(ctx, lock)
}).
AddWatch(ctx)
Expand Down
4 changes: 2 additions & 2 deletions internal/linux/sensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
)

const (
SOURCE_DBUS = "D-Bus"
SOURCE_PROCFS = "ProcFS"
srcDbus = "D-Bus"
srcProcfs = "ProcFS"
)

// linuxSensor represents a generic sensor on the Linux platform. Most sensors
Expand Down
2 changes: 1 addition & 1 deletion internal/linux/usersSensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (s *usersSensor) Attributes() interface{} {
DataSource string `json:"Data Source"`
Usernames []string `json:"Usernames"`
}{
DataSource: SOURCE_DBUS,
DataSource: srcDbus,
Usernames: s.userNames,
}
}
Expand Down

0 comments on commit 657d853

Please sign in to comment.