Skip to content

Commit 259cd2c

Browse files
committed
slog: remove reference to Attr "having a value"
Remove the HasValue method and references to an Attr having a value. Attrs always have values, and one of those values is nil. Change-Id: I410f85fb78c1722119e71b7c4e0b30278318083d Reviewed-on: https://go-review.googlesource.com/c/exp/+/429839 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Jonathan Amsterdam <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
1 parent dc92f86 commit 259cd2c

File tree

2 files changed

+0
-7
lines changed

2 files changed

+0
-7
lines changed

slog/attr.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ func Any(key string, value any) Attr {
150150
func (a Attr) Key() string { return a.key }
151151

152152
// Value returns the Attr's value as an any.
153-
// If the Attr does not have a value, it returns nil.
154153
func (a Attr) Value() any {
155154
switch a.Kind() {
156155
case AnyKind:
@@ -174,9 +173,6 @@ func (a Attr) Value() any {
174173
}
175174
}
176175

177-
// HasValue reports whether the Attr has a non-nil value.
178-
func (a Attr) HasValue() bool { return a.any != nil }
179-
180176
// Int64 returns the Attr's value as an int64. It panics
181177
// if the value is not a signed integer.
182178
func (a Attr) Int64() int64 {

slog/attr_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ func TestNilAttr(t *testing.T) {
4040
if g := n.Value(); g != nil {
4141
t.Errorf("got %#v, want nil", g)
4242
}
43-
if n.HasValue() {
44-
t.Error("n has value, wanted not")
45-
}
4643
}
4744

4845
func panics(f func()) (b bool) {

0 commit comments

Comments
 (0)