diff --git a/log/internal/writer_logger.go b/log/internal/writer_logger.go index 6b619b8d4c8..e9453066950 100644 --- a/log/internal/writer_logger.go +++ b/log/internal/writer_logger.go @@ -59,8 +59,6 @@ func (l *writerLogger) appendValue(v log.Value) { l.write(v.String()) case log.KindInt64: l.write(strconv.FormatInt(v.Int64(), 10)) // strconv.FormatInt allocates memory. - case log.KindUint64: - l.write(strconv.FormatInt(int64(v.Uint64()), 10)) // strconv.FormatInt allocates memory. case log.KindFloat64: l.write(strconv.FormatFloat(v.Float64(), 'g', -1, 64)) // strconv.FormatFloat allocates memory. case log.KindBool: diff --git a/log/value.go b/log/value.go index 24969eef81e..62a5c6ab51e 100644 --- a/log/value.go +++ b/log/value.go @@ -19,7 +19,7 @@ import ( // The zero Value corresponds to nil. type Value struct { _ [0]func() // disallow == - // num holds the value for Kinds: Int64, Uint64, Float64, and Bool, + // num holds the value for Kinds: Int64, Float64, and Bool, // the length for String, Bytes, Group. num uint64 // If any is of type Kind, then the value is in num as described above. @@ -43,7 +43,6 @@ const ( KindFloat64 KindInt64 KindString - KindUint64 KindBytes KindGroup ) @@ -54,7 +53,6 @@ var kindStrings = []string{ "Float64", "Int64", "String", - "Uint64", "Bytes", "Group", } @@ -99,11 +97,6 @@ func Int64Value(v int64) Value { return Value{num: uint64(v), any: KindInt64} } -// Uint64Value returns a [Value] for a uint64. -func Uint64Value(v uint64) Value { - return Value{num: v, any: KindUint64} -} - // Float64Value returns a [Value] for a floating-point number. func Float64Value(v float64) Value { return Value{num: math.Float64bits(v), any: KindFloat64} @@ -160,8 +153,6 @@ func (v Value) Any() any { return v.group() case KindInt64: return int64(v.num) - case KindUint64: - return v.num case KindFloat64: return v.float() case KindString: @@ -201,15 +192,6 @@ func (v Value) Int64() int64 { return int64(v.num) } -// Uint64 returns v's value as a uint64. It panics -// if v is not an unsigned integer. -func (v Value) Uint64() uint64 { - if g, w := v.Kind(), KindUint64; g != w { - panic(fmt.Sprintf("Value kind is %s, not %s", g, w)) - } - return v.num -} - // Bool returns v's value as a bool. It panics // if v is not a bool. func (v Value) Bool() bool { @@ -276,7 +258,7 @@ func (v Value) Equal(w Value) bool { return false } switch k1 { - case KindInt64, KindUint64, KindBool: + case KindInt64, KindBool: return v.num == w.num case KindString: return v.str() == w.str() @@ -312,8 +294,6 @@ func (v Value) append(dst []byte) []byte { return append(dst, v.str()...) case KindInt64: return strconv.AppendInt(dst, int64(v.num), 10) - case KindUint64: - return strconv.AppendUint(dst, v.num, 10) case KindFloat64: return strconv.AppendFloat(dst, v.float(), 'g', -1, 64) case KindBool: @@ -351,11 +331,6 @@ func Int(key string, value int) KeyValue { return Int64(key, int64(value)) } -// Uint64 returns an KeyValue for a uint64. -func Uint64(key string, v uint64) KeyValue { - return KeyValue{key, Uint64Value(v)} -} - // Float64 returns an KeyValue for a floating-point number. func Float64(key string, v float64) KeyValue { return KeyValue{key, Float64Value(v)} diff --git a/log/value_test.go b/log/value_test.go index 68b3ea09543..512e89d5d06 100644 --- a/log/value_test.go +++ b/log/value_test.go @@ -50,7 +50,6 @@ func TestValueString(t *testing.T) { want string }{ {Int64Value(-3), "-3"}, - {Uint64Value(1), "1"}, {Float64Value(.15), "0.15"}, {BoolValue(true), "true"}, {StringValue("foo"), "foo"}, @@ -67,7 +66,6 @@ func TestValueNoAlloc(t *testing.T) { // Assign values just to make sure the compiler doesn't optimize away the statements. var ( i int64 - u uint64 f float64 b bool by []byte @@ -76,7 +74,6 @@ func TestValueNoAlloc(t *testing.T) { bytes := []byte{1, 3, 4} a := int(testing.AllocsPerRun(5, func() { i = Int64Value(1).Int64() - u = Uint64Value(1).Uint64() f = Float64Value(1).Float64() b = BoolValue(true).Bool() by = BytesValue(bytes).Bytes() @@ -84,7 +81,6 @@ func TestValueNoAlloc(t *testing.T) { })) assert.Zero(t, a) _ = i - _ = u _ = f _ = b _ = by @@ -95,7 +91,6 @@ func TestKeyValueNoAlloc(t *testing.T) { // Assign values just to make sure the compiler doesn't optimize away the statements. var ( i int64 - u uint64 f float64 b bool by []byte @@ -104,7 +99,6 @@ func TestKeyValueNoAlloc(t *testing.T) { bytes := []byte{1, 3, 4} a := int(testing.AllocsPerRun(5, func() { i = Int64("key", 1).Value.Int64() - u = Uint64("key", 1).Value.Uint64() f = Float64("key", 1).Value.Float64() b = Bool("key", true).Value.Bool() by = Bytes("key", bytes).Value.Bytes() @@ -112,7 +106,6 @@ func TestKeyValueNoAlloc(t *testing.T) { })) assert.Zero(t, a) _ = i - _ = u _ = f _ = b _ = by @@ -127,7 +120,6 @@ func TestValueAny(t *testing.T) { {"s", StringValue("s")}, {true, BoolValue(true)}, {int64(4), IntValue(4)}, - {uint64(2), Uint64Value(2)}, {int64(11), Int64Value(11)}, {1.5, Float64Value(1.5)}, {[]byte{1, 2, 3}, BytesValue([]byte{1, 2, 3})},