fix: resolve all golangci-lint errors
Some checks failed
CI/CD / Test (push) Successful in 29s
CI/CD / Lint (push) Successful in 39s
CI/CD / Generate SBOM (push) Successful in 16s
CI/CD / Build (darwin-amd64) (push) Successful in 21s
CI/CD / Build (linux-amd64) (push) Successful in 20s
CI/CD / Build (darwin-arm64) (push) Successful in 21s
CI/CD / Build (linux-arm64) (push) Successful in 21s
CI/CD / Build & Push Docker Image (push) Failing after 4s
CI/CD / Release (push) Has been skipped

- Add error checks for w.Write, json.Encode, os.MkdirAll, os.WriteFile, file.Seek
- Fix gosimple S1000: use for range instead of for { select {} }
- Fix ineffectual assignments in adaptive_io.go
- Add nolint directives for unused code intended for future use
- Fix SA1029: use custom contextKey type instead of string
- Fix SA9003: remove empty branch in client_network_handler.go
- All linting checks now pass
This commit is contained in:
2025-12-11 21:17:37 +01:00
parent 64a5daa790
commit 7b9a0e4041
12 changed files with 368 additions and 344 deletions

View File

@@ -70,34 +70,31 @@ func MonitorUploadPerformance() {
ticker := time.NewTicker(60 * time.Second)
defer ticker.Stop()
for {
select {
case <-ticker.C:
// Log upload session statistics
if uploadSessionStore != nil {
uploadSessionStore.mutex.RLock()
activeSessionsCount := len(uploadSessionStore.sessions)
uploadSessionStore.mutex.RUnlock()
if activeSessionsCount > 0 {
log.Infof("Active upload sessions: %d", activeSessionsCount)
}
}
for range ticker.C {
// Log upload session statistics
if uploadSessionStore != nil {
uploadSessionStore.mutex.RLock()
activeSessionsCount := len(uploadSessionStore.sessions)
uploadSessionStore.mutex.RUnlock()
// Log network resilience status
if networkManager != nil {
networkManager.mutex.RLock()
activeUploadsCount := len(networkManager.activeUploads)
isPaused := networkManager.isPaused
networkManager.mutex.RUnlock()
if activeUploadsCount > 0 {
status := "active"
if isPaused {
status = "paused"
}
log.Infof("Network resilience: %d uploads %s", activeUploadsCount, status)
if activeSessionsCount > 0 {
log.Infof("Active upload sessions: %d", activeSessionsCount)
}
}
// Log network resilience status
if networkManager != nil {
networkManager.mutex.RLock()
activeUploadsCount := len(networkManager.activeUploads)
isPaused := networkManager.isPaused
networkManager.mutex.RUnlock()
if activeUploadsCount > 0 {
status := "active"
if isPaused {
status = "paused"
}
log.Infof("Network resilience: %d uploads %s", activeUploadsCount, status)
}
}
}