From b0ba546a1fa5b53055ee4f29d84293213a551b92 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Thu, 18 Jun 2020 12:39:11 -0400 Subject: [PATCH] Remove bytesToUint64 from agent/consul --- agent/consul/util.go | 14 -------------- agent/consul/util_test.go | 9 --------- 2 files changed, 23 deletions(-) diff --git a/agent/consul/util.go b/agent/consul/util.go index c58891863c..6405b33493 100644 --- a/agent/consul/util.go +++ b/agent/consul/util.go @@ -1,8 +1,6 @@ package consul import ( - "encoding/binary" - "fmt" "runtime" "strconv" @@ -50,18 +48,6 @@ func isConsulNode(m serf.Member) (bool, string) { return true, m.Tags["dc"] } -// Converts bytes to an integer -func bytesToUint64(b []byte) uint64 { - return binary.BigEndian.Uint64(b) -} - -// Converts a uint to a byte slice -func uint64ToBytes(u uint64) []byte { - buf := make([]byte, 8) - binary.BigEndian.PutUint64(buf, u) - return buf -} - // runtimeStats is used to return various runtime information func runtimeStats() map[string]string { return map[string]string{ diff --git a/agent/consul/util_test.go b/agent/consul/util_test.go index 0c8c378841..7a68f035e5 100644 --- a/agent/consul/util_test.go +++ b/agent/consul/util_test.go @@ -125,15 +125,6 @@ func TestIsConsulNode(t *testing.T) { } } -func TestByteConversion(t *testing.T) { - t.Parallel() - var val uint64 = 2 << 50 - raw := uint64ToBytes(val) - if bytesToUint64(raw) != val { - t.Fatalf("no match") - } -} - func TestGenerateUUID(t *testing.T) { t.Parallel() prev := generateUUID()