From 75b705aa87b053b398e7ce1f223304b1155adde8 Mon Sep 17 00:00:00 2001 From: Holger Obermaier <40787752+ho-ob@users.noreply.github.com> Date: Tue, 19 Sep 2023 17:00:16 +0200 Subject: [PATCH] Avoid package cmp to allow builds with golang v1.20 --- sinks/httpSink.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sinks/httpSink.go b/sinks/httpSink.go index 4f2e49b..f00e4a3 100644 --- a/sinks/httpSink.go +++ b/sinks/httpSink.go @@ -2,7 +2,6 @@ package sinks import ( "bytes" - "cmp" "encoding/json" "errors" "fmt" @@ -102,7 +101,13 @@ func (s *HttpSink) Write(m lp.CCMetric) error { slices.SortFunc( key_value_store, func(a key_value, b key_value) int { - return cmp.Compare(a.key, b.key) + if a.key < b.key { + return -1 + } + if a.key > b.key { + return +1 + } + return 0 }, ) for i := range key_value_store {