From e151db3e065eea8a13fd2bc83aafb6959edd6fca Mon Sep 17 00:00:00 2001 From: Jes Cok Date: Mon, 28 Jul 2025 11:36:17 +0000 Subject: all: omit unnecessary type conversions Found by github.com/mdempsky/unconvert Change-Id: Ib78cceb718146509d96dbb6da87b27dbaeba1306 GitHub-Last-Rev: dedf354811701ce8920c305b6f7aa78914a4171c GitHub-Pull-Request: golang/go#74771 Reviewed-on: https://go-review.googlesource.com/c/go/+/690735 Reviewed-by: Mark Freeman LUCI-TryBot-Result: Go LUCI Reviewed-by: Keith Randall Auto-Submit: Keith Randall Reviewed-by: Keith Randall --- src/time/example_test.go | 4 ++-- src/time/sleep.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/time') diff --git a/src/time/example_test.go b/src/time/example_test.go index eeadcdb1c1..05eac86738 100644 --- a/src/time/example_test.go +++ b/src/time/example_test.go @@ -735,8 +735,8 @@ func ExampleTime_String() { timeWithoutNanoseconds := time.Date(2000, 2, 1, 12, 13, 14, 0, time.UTC) withoutNanoseconds := timeWithoutNanoseconds.String() - fmt.Printf("withNanoseconds = %v\n", string(withNanoseconds)) - fmt.Printf("withoutNanoseconds = %v\n", string(withoutNanoseconds)) + fmt.Printf("withNanoseconds = %v\n", withNanoseconds) + fmt.Printf("withoutNanoseconds = %v\n", withoutNanoseconds) // Output: // withNanoseconds = 2000-02-01 12:13:14.000000015 +0000 UTC diff --git a/src/time/sleep.go b/src/time/sleep.go index e9cd483be5..4b7750eb94 100644 --- a/src/time/sleep.go +++ b/src/time/sleep.go @@ -142,7 +142,7 @@ func (t *Timer) Stop() bool { // in Go 1.27 or later. func NewTimer(d Duration) *Timer { c := make(chan Time, 1) - t := (*Timer)(newTimer(when(d), 0, sendTime, c, syncTimer(c))) + t := newTimer(when(d), 0, sendTime, c, syncTimer(c)) t.C = c return t } @@ -208,7 +208,7 @@ func After(d Duration) <-chan Time { // be used to cancel the call using its Stop method. // The returned Timer's C field is not used and will be nil. func AfterFunc(d Duration, f func()) *Timer { - return (*Timer)(newTimer(when(d), 0, goFunc, f, nil)) + return newTimer(when(d), 0, goFunc, f, nil) } func goFunc(arg any, seq uintptr, delta int64) { -- cgit v1.3