chore: style fixes from go fix (#10846)

Just `go fix ./...`

Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
Jakob Borg
2026-08-05 20:23:22 +02:00
committed by GitHub
parent 946e2b83a1
commit 8ea09c0094
144 changed files with 211 additions and 315 deletions
+15 -15
View File
@@ -116,7 +116,7 @@ type Model interface {
Availability(folder string, file protocol.FileInfo, block protocol.BlockInfo) ([]Availability, error)
Completion(device protocol.DeviceID, folder string) (FolderCompletion, error)
ConnectionStats() map[string]interface{}
ConnectionStats() map[string]any
DeviceStatistics() (map[protocol.DeviceID]stats.DeviceStatistics, error)
FolderStatistics() (map[string]stats.FolderStatistics, error)
UsageReportingStats(report *contract.Report, version int, preview bool)
@@ -684,7 +684,7 @@ type ConnectionStats struct {
IsLocal bool `json:"isLocal"` // mirror values from Primary, for compatibility with <1.24.0
Crypto string `json:"crypto"` // mirror values from Primary, for compatibility with <1.24.0
Primary ConnectionInfo `json:"primary,omitempty"`
Primary ConnectionInfo `json:"primary"`
Secondary []ConnectionInfo `json:"secondary,omitempty"`
}
@@ -698,11 +698,11 @@ type ConnectionInfo struct {
}
// ConnectionStats returns a map with connection statistics for each device.
func (m *model) ConnectionStats() map[string]interface{} {
func (m *model) ConnectionStats() map[string]any {
m.mut.RLock()
defer m.mut.RUnlock()
res := make(map[string]interface{})
res := make(map[string]any)
devs := m.cfg.Devices()
conns := make(map[string]ConnectionStats, len(devs))
for device, deviceCfg := range devs {
@@ -762,7 +762,7 @@ func (m *model) ConnectionStats() map[string]interface{} {
res["connections"] = conns
in, out := protocol.TotalInOut()
res["total"] = map[string]interface{}{
res["total"] = map[string]any{
"at": time.Now().Truncate(time.Second),
"inBytesTotal": in,
"outBytesTotal": out,
@@ -862,8 +862,8 @@ func (comp *FolderCompletion) setCompletionPct() {
}
// Map returns the members as a map, e.g. used in api to serialize as JSON.
func (comp *FolderCompletion) Map() map[string]interface{} {
return map[string]interface{}{
func (comp *FolderCompletion) Map() map[string]any {
return map[string]any{
"completion": comp.CompletionPct,
"globalBytes": comp.GlobalBytes,
"needBytes": comp.NeedBytes,
@@ -1516,7 +1516,7 @@ func (m *model) ccHandleFolders(folders []protocol.Folder, deviceCfg config.Devi
})
}
if len(updatedPending) > 0 || len(expiredPendingList) > 0 {
m.evLogger.Log(events.PendingFoldersChanged, map[string]interface{}{
m.evLogger.Log(events.PendingFoldersChanged, map[string]any{
"added": updatedPending,
"removed": expiredPendingList,
})
@@ -2266,7 +2266,7 @@ func (m *model) OnHello(remoteID protocol.DeviceID, addr net.Addr, hello protoco
if err := m.observed.AddOrUpdatePendingDevice(remoteID, hello.DeviceName, addr.String()); err != nil {
slog.Warn("Failed to persist pending device entry to database", slogutil.Error(err))
}
m.evLogger.Log(events.PendingDevicesChanged, map[string][]interface{}{
m.evLogger.Log(events.PendingDevicesChanged, map[string][]any{
"added": {map[string]string{
"deviceID": remoteID.String(),
"name": hello.DeviceName,
@@ -2426,7 +2426,7 @@ func (m *model) DownloadProgress(conn protocol.Connection, p *protocol.DownloadP
downloads.Update(p.Folder, p.Updates)
state := downloads.GetBlockCounts(p.Folder)
m.evLogger.Log(events.RemoteDownloadProgress, map[string]interface{}{
m.evLogger.Log(events.RemoteDownloadProgress, map[string]any{
"device": deviceID.String(),
"folder": p.Folder,
"state": state,
@@ -2772,7 +2772,7 @@ func (m *model) GlobalDirectoryTree(folder, prefix string, levels int, dirsOnly
parent := root
if dir != "." {
for _, path := range strings.Split(dir, sep) {
for path := range strings.SplitSeq(dir, sep) {
child := findByName(parent.Children, path)
if child == nil {
return nil, fmt.Errorf("could not find child '%s' for path '%s' in parent '%s'", path, f.Name, parent.Name)
@@ -3183,7 +3183,7 @@ func (m *model) cleanPending(existingDevices map[protocol.DeviceID]config.Device
}
}
if len(removedPendingFolders) > 0 {
m.evLogger.Log(events.PendingFoldersChanged, map[string]interface{}{
m.evLogger.Log(events.PendingFoldersChanged, map[string]any{
"removed": removedPendingFolders,
})
}
@@ -3218,7 +3218,7 @@ func (m *model) cleanPending(existingDevices map[protocol.DeviceID]config.Device
})
}
if len(removedPendingDevices) > 0 {
m.evLogger.Log(events.PendingDevicesChanged, map[string]interface{}{
m.evLogger.Log(events.PendingDevicesChanged, map[string]any{
"removed": removedPendingDevices,
})
}
@@ -3264,7 +3264,7 @@ func (m *model) DismissPendingDevice(device protocol.DeviceID) error {
removedPendingDevices := []map[string]string{
{"deviceID": device.String()},
}
m.evLogger.Log(events.PendingDevicesChanged, map[string]interface{}{
m.evLogger.Log(events.PendingDevicesChanged, map[string]any{
"removed": removedPendingDevices,
})
return nil
@@ -3298,7 +3298,7 @@ func (m *model) DismissPendingFolder(device protocol.DeviceID, folder string) er
}
}
if len(removedPendingFolders) > 0 {
m.evLogger.Log(events.PendingFoldersChanged, map[string]interface{}{
m.evLogger.Log(events.PendingFoldersChanged, map[string]any{
"removed": removedPendingFolders,
})
}