aboutsummaryrefslogtreecommitdiff
path: root/climb/detection.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-08-27 11:32:31 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-08-27 11:32:31 +0200
commit1c5fc2e4364063884f33b78f45f351201705fae4 (patch)
treed0f76e824a9910771946d4f4c21905309f4f4788 /climb/detection.go
parent825cf388b55a6c8441e02149749bb6e2968477c0 (diff)
Tame the deadcode gate and remove dead web helpers
Run deadcode with -test and without the vendored node_modules package so the check reports only genuinely unreachable code instead of test-only helpers and vendored functions. Remove the three web helpers it still flagged (formatBikeType, formatRideType, dataQualityURL) that had no callers. Apply the go fix modernizations the check gate performs (range-over-int loops and embedded-field composite literals) that the gate had rewritten in the working tree.
Diffstat (limited to 'climb/detection.go')
-rw-r--r--climb/detection.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/climb/detection.go b/climb/detection.go
index 1efe1c5..9269c2f 100644
--- a/climb/detection.go
+++ b/climb/detection.go
@@ -127,7 +127,7 @@ func bestClimbBetween(distances, elevations []float64, minSlope float64) (core.I
bestDetectionScore := climbDetectionScore(distances, elevations)
best := core.NewInterval(0, end)
- for i := 0; i < end; i++ {
+ for i := range end {
detectionScore := climbDetectionScore(distances[i:end], elevations[i:end])
if detectionScore > bestDetectionScore {
best.Start = i
@@ -155,7 +155,7 @@ func bestClimbBetween(distances, elevations []float64, minSlope float64) (core.I
// Classic best too gentle: re-segment into the best qualifying sub-segment.
bestDetectionScore = math.Inf(-1)
best = core.NewInterval(-1, -1)
- for i := 0; i < end; i++ {
+ for i := range end {
for j := i + 1; j <= end; j++ {
if Slope(distances[i:j+1], elevations[i:j+1]) < minSlope {
continue