fix: mark unused parameters to satisfy unparam linter

Mark intentionally unused parameters with underscore to:
- Silence unparam warnings for legitimate unused parameters
- Keep function signatures intact for API compatibility
- Remove unused req from serveChecksum helper
This commit is contained in:
rcourtman 2025-11-27 10:11:52 +00:00
parent 252d060a58
commit 31927f71e9
8 changed files with 11 additions and 12 deletions

View file

@ -6839,7 +6839,7 @@ func calculateTrimmedBaseline(samples []float64) (baseline float64, trustworthy
}
// checkPMGAnomalies detects spam/virus rate anomalies using trimmed baseline
func (m *Manager) checkPMGAnomalies(pmg models.PMGInstance, defaults PMGThresholdConfig) {
func (m *Manager) checkPMGAnomalies(pmg models.PMGInstance, _ PMGThresholdConfig) {
// Need mail count data
if len(pmg.MailCount) == 0 {
return

View file

@ -5997,7 +5997,7 @@ func (h *ConfigHandlers) HandleAutoRegister(w http.ResponseWriter, r *http.Reque
}
// handleSecureAutoRegister handles the new secure registration flow where Pulse generates the token
func (h *ConfigHandlers) handleSecureAutoRegister(w http.ResponseWriter, r *http.Request, req *AutoRegisterRequest, clientIP string) {
func (h *ConfigHandlers) handleSecureAutoRegister(w http.ResponseWriter, _ *http.Request, req *AutoRegisterRequest, clientIP string) {
log.Info().
Str("type", req.Type).
Str("host", req.Host).

View file

@ -1451,7 +1451,7 @@ func normalizeVersionLabel(raw string) string {
}
// checkVMDiskMonitoring performs diagnostic checks for VM disk monitoring
func (r *Router) checkVMDiskMonitoring(ctx context.Context, client *proxmox.Client, nodeName string) *VMDiskCheckResult {
func (r *Router) checkVMDiskMonitoring(ctx context.Context, client *proxmox.Client, _ string) *VMDiskCheckResult {
result := &VMDiskCheckResult{
Recommendations: []string{},
Permissions: []string{},
@ -1716,7 +1716,7 @@ func (r *Router) checkVMDiskMonitoring(ctx context.Context, client *proxmox.Clie
}
// checkPhysicalDisks performs diagnostic checks for physical disk detection
func (r *Router) checkPhysicalDisks(ctx context.Context, client *proxmox.Client, instanceName string) *PhysicalDiskCheck {
func (r *Router) checkPhysicalDisks(ctx context.Context, client *proxmox.Client, _ string) *PhysicalDiskCheck {
result := &PhysicalDiskCheck{
Recommendations: []string{},
NodeResults: []NodeDiskResult{},

View file

@ -3591,7 +3591,7 @@ func (r *Router) tryServeHostAgentBinary(w http.ResponseWriter, req *http.Reques
checkedPaths = append(checkedPaths, path)
if info, err := os.Stat(path); err == nil && !info.IsDir() {
if strings.HasSuffix(req.URL.Path, ".sha256") {
r.serveChecksum(w, req, path)
r.serveChecksum(w, path)
return checkedPaths, true
}
http.ServeFile(w, req, path)
@ -3663,7 +3663,7 @@ func sortedHostAgentKeys(missing map[string]agentbinaries.HostAgentBinary) []str
}
// serveChecksum computes and serves the SHA256 checksum of a file
func (r *Router) serveChecksum(w http.ResponseWriter, req *http.Request, filepath string) {
func (r *Router) serveChecksum(w http.ResponseWriter, filepath string) {
file, err := os.Open(filepath)
if err != nil {
http.Error(w, "Failed to open file", http.StatusInternalServerError)

View file

@ -21,7 +21,7 @@ func (r *Router) handleOIDCConfig(w http.ResponseWriter, req *http.Request) {
}
}
func (r *Router) handleGetOIDCConfig(w http.ResponseWriter, req *http.Request) {
func (r *Router) handleGetOIDCConfig(w http.ResponseWriter, _ *http.Request) {
cfg := r.ensureOIDCConfig()
response := makeOIDCResponse(cfg, r.config.PublicURL)

View file

@ -119,7 +119,7 @@ func discoveryConfigMap(raw map[string]interface{}) (map[string]interface{}, boo
}
// validateSystemSettings validates settings before applying them
func validateSystemSettings(settings *config.SystemSettings, rawRequest map[string]interface{}) error {
func validateSystemSettings(_ *config.SystemSettings, rawRequest map[string]interface{}) error {
if val, ok := rawRequest["pvePollingInterval"]; ok {
if interval, ok := val.(float64); ok {
if interval <= 0 {

View file

@ -1020,7 +1020,7 @@ func (a *Agent) sendReport(ctx context.Context, report agentsdocker.Report) erro
return nil
}
func (a *Agent) sendReportToTarget(ctx context.Context, target TargetConfig, payload []byte, containerCount int) error {
func (a *Agent) sendReportToTarget(ctx context.Context, target TargetConfig, payload []byte, _ int) error {
url := fmt.Sprintf("%s/api/agents/docker/report", target.URL)
req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(payload))
if err != nil {

View file

@ -624,7 +624,6 @@ func safePercentage(used, total float64) float64 {
return result
}
// safeFloat ensures a float value is not NaN or Inf
func safeFloat(val float64) float64 {
if math.IsNaN(val) || math.IsInf(val, 0) {
@ -4572,7 +4571,7 @@ func (m *Monitor) retryFailedConnections(ctx context.Context) {
}
// poll fetches data from all configured instances
func (m *Monitor) poll(ctx context.Context, wsHub *websocket.Hub) {
func (m *Monitor) poll(_ context.Context, wsHub *websocket.Hub) {
defer recoverFromPanic("poll")
// Limit concurrent polls to 2 to prevent resource exhaustion
@ -4788,7 +4787,7 @@ func derivePollTimeout(cfg *config.Config) time.Duration {
return timeout
}
func (m *Monitor) taskExecutionTimeout(instanceType InstanceType) time.Duration {
func (m *Monitor) taskExecutionTimeout(_ InstanceType) time.Duration {
if m == nil {
return defaultTaskTimeout
}