mirror of
https://github.com/status-im/consul.git
synced 2025-01-11 06:16:08 +00:00
Remove bytesToUint64 from agent/consul
This commit is contained in:
parent
a00f007c5e
commit
b0ba546a1f
@ -1,8 +1,6 @@
|
|||||||
package consul
|
package consul
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
|
||||||
"fmt"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@ -50,18 +48,6 @@ func isConsulNode(m serf.Member) (bool, string) {
|
|||||||
return true, m.Tags["dc"]
|
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
|
// runtimeStats is used to return various runtime information
|
||||||
func runtimeStats() map[string]string {
|
func runtimeStats() map[string]string {
|
||||||
return map[string]string{
|
return map[string]string{
|
||||||
|
@ -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) {
|
func TestGenerateUUID(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
prev := generateUUID()
|
prev := generateUUID()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user