From 70da7fb1a411e49c92be3b2699897cc9e9ef6967 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Sat, 15 Nov 2025 20:03:09 +0000 Subject: [PATCH] refactor: fix unused method receiver Methods with unused receivers can be a symptom of unfinished refactoring or a bug. To keep the same method signature, omit the receiver name or '_' as it is unused. --- admin/ops.go | 9 +++++---- clustering/broadcast-delegate.go | 7 ++++--- query/query.go | 15 ++++++++------- world/location.go | 5 +++-- world/tree.go | 7 ++++--- 5 files changed, 24 insertions(+), 19 deletions(-) diff --git a/admin/ops.go b/admin/ops.go index cf3dc64..5522ed2 100644 --- a/admin/ops.go +++ b/admin/ops.go @@ -3,13 +3,14 @@ package admin import ( "embed" "encoding/json" - "github.com/fabricekabongo/loggerhead/clustering" - "github.com/fabricekabongo/loggerhead/config" - "github.com/prometheus/client_golang/prometheus/promhttp" "html/template" "log" "net/http" "runtime" + + "github.com/fabricekabongo/loggerhead/clustering" + "github.com/fabricekabongo/loggerhead/config" + "github.com/prometheus/client_golang/prometheus/promhttp" ) var ( @@ -128,7 +129,7 @@ func (o *OpsServer) AdminData() http.Handler { }) } -func (o *OpsServer) AdminUI() http.Handler { +func (*OpsServer) AdminUI() http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { err := TMPL.Execute(w, nil) if err != nil { diff --git a/clustering/broadcast-delegate.go b/clustering/broadcast-delegate.go index db0d1e0..48f6e18 100644 --- a/clustering/broadcast-delegate.go +++ b/clustering/broadcast-delegate.go @@ -1,13 +1,14 @@ package clustering import ( + "log" + "os" + "github.com/fabricekabongo/loggerhead/query" "github.com/fabricekabongo/loggerhead/world" "github.com/hashicorp/memberlist" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "log" - "os" ) var ( @@ -52,7 +53,7 @@ func newBroadcastDelegate(engine *query.Engine, broadcasts *memberlist.TransmitL } } -func (d *BroadcastDelegate) NodeMeta(limit int) []byte { +func (*BroadcastDelegate) NodeMeta(limit int) []byte { return []byte{} } diff --git a/query/query.go b/query/query.go index fa9797a..0b8c18d 100644 --- a/query/query.go +++ b/query/query.go @@ -2,14 +2,15 @@ package query import ( "errors" - w "github.com/fabricekabongo/loggerhead/world" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" "log" "os" "strconv" "strings" "time" + + w "github.com/fabricekabongo/loggerhead/world" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" ) var ( @@ -205,7 +206,7 @@ func (p *GetQueryProcessor) Execute(query string) string { return stringBuilder.String() } -func (p *GetQueryProcessor) CanProcess(query string) bool { +func (*GetQueryProcessor) CanProcess(query string) bool { chunks := strings.Split(query, " ") if len(chunks) != 3 { return false @@ -248,7 +249,7 @@ func (p *DeleteQueryProcessor) Execute(query string) string { return version + ",deleted\n" } -func (p *DeleteQueryProcessor) CanProcess(query string) bool { +func (*DeleteQueryProcessor) CanProcess(query string) bool { chunks := strings.Split(query, " ") if len(chunks) != 3 { return false @@ -305,7 +306,7 @@ func (p *SaveQueryProcessor) Execute(query string) string { return version + ",saved\n" } -func (p *SaveQueryProcessor) CanProcess(query string) bool { +func (*SaveQueryProcessor) CanProcess(query string) bool { chunks := strings.Split(query, " ") if len(chunks) != 5 { return false @@ -370,7 +371,7 @@ func (p *PolyQueryProcessor) Execute(query string) string { return result.String() } -func (p *PolyQueryProcessor) CanProcess(query string) bool { +func (*PolyQueryProcessor) CanProcess(query string) bool { chunks := strings.Split(query, " ") if len(chunks) != 6 { return false diff --git a/world/location.go b/world/location.go index 13721f7..dfef064 100644 --- a/world/location.go +++ b/world/location.go @@ -4,9 +4,10 @@ import ( "encoding/gob" "errors" "fmt" + "time" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" - "time" ) var ( @@ -58,7 +59,7 @@ func NewLocation(ns string, id string, lat float64, lon float64) (*Location, err return loc, nil } -func (l *Location) init(ns string, id string, lat float64, lon float64) (*Location, error) { +func (*Location) init(ns string, id string, lat float64, lon float64) (*Location, error) { if len(id) == 0 { validationOps.Inc() return nil, LocationErrorRequiredId diff --git a/world/tree.go b/world/tree.go index 8f4fbdf..cef35e9 100644 --- a/world/tree.go +++ b/world/tree.go @@ -2,10 +2,11 @@ package world import ( "errors" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" "math" "sync" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" ) var ( @@ -155,7 +156,7 @@ func (node *TreeNode) divide() { node.mu.Unlock() } -func (q *QuadTree) reBalance() { +func (*QuadTree) reBalance() { // TODO: Implement rebalancing }