Skip to content

Commit

Permalink
slog: update value receiver names
Browse files Browse the repository at this point in the history
This change unifies the naming of the receivers in the value.go
file (https://github.com/golang/exp/blob/master/slog/value.go).

It also fixes the discrepancy between the doc comment
("v's value") and the receiver's name for this function:
https://github.com/golang/exp/blob/d63ba01acd4b5892385c4390b334ea2c89f27eb7/slog/value.go#L281-L283

Change-Id: I66651b1c4746a868d54d24675119a2e28db8af42
GitHub-Last-Rev: 424805c
GitHub-Pull-Request: #65
Reviewed-on: https://go-review.googlesource.com/c/exp/+/516755
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Cottrell <iancottrell@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Reviewed-by: qiulaidongfeng <2645477756@qq.com>
  • Loading branch information
suntala authored and jba committed Aug 9, 2023
1 parent 050eac2 commit 853ea24
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions slog/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,22 @@ func (v Value) Bool() bool {
return v.bool()
}

func (a Value) bool() bool {
return a.num == 1
func (v Value) bool() bool {
return v.num == 1
}

// Duration returns v's value as a time.Duration. It panics
// if v is not a time.Duration.
func (a Value) Duration() time.Duration {
if g, w := a.Kind(), KindDuration; g != w {
func (v Value) Duration() time.Duration {
if g, w := v.Kind(), KindDuration; g != w {
panic(fmt.Sprintf("Value kind is %s, not %s", g, w))
}

return a.duration()
return v.duration()
}

func (a Value) duration() time.Duration {
return time.Duration(int64(a.num))
func (v Value) duration() time.Duration {
return time.Duration(int64(v.num))
}

// Float64 returns v's value as a float64. It panics
Expand All @@ -302,8 +302,8 @@ func (v Value) Float64() float64 {
return v.float()
}

func (a Value) float() float64 {
return math.Float64frombits(a.num)
func (v Value) float() float64 {
return math.Float64frombits(v.num)
}

// Time returns v's value as a time.Time. It panics
Expand Down

0 comments on commit 853ea24

Please sign in to comment.