mirror of
https://github.com/golang/go
synced 2024-11-07 05:46:17 -07:00
bb09f8a29b
Previously calling fmt.Sprintf("%#v", t) on a time.Time value would yield a result like: time.Time{wall:0x0, ext:63724924180, loc:(*time.Location)(nil)} which does not compile when embedded in a Go program, and does not tell you what value is represented at a glance. This change adds a GoString method that returns much more legible output: "time.Date(2009, time.February, 5, 5, 0, 57, 12345600, time.UTC)" which gives you more information about the time.Time and also can be usefully embedded in a Go program without additional work. Update Quote() to hex escape non-ASCII characters (copying logic from strconv), which makes it safer to embed them in the output of GoString(). Fixes #39034. Change-Id: Ic985bafe4e556f64e82223c643f65143c9a45c3b Reviewed-on: https://go-review.googlesource.com/c/go/+/267017 Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> |
||
---|---|---|
.. | ||
testdata | ||
tzdata | ||
embed.go | ||
example_test.go | ||
export_android_test.go | ||
export_test.go | ||
export_windows_test.go | ||
format_test.go | ||
format.go | ||
genzabbrs.go | ||
internal_test.go | ||
mono_test.go | ||
sleep_test.go | ||
sleep.go | ||
sys_plan9.go | ||
sys_unix.go | ||
sys_windows.go | ||
tick_test.go | ||
tick.go | ||
time_test.go | ||
time.go | ||
tzdata_test.go | ||
zoneinfo_abbrs_windows.go | ||
zoneinfo_android_test.go | ||
zoneinfo_android.go | ||
zoneinfo_ios.go | ||
zoneinfo_js.go | ||
zoneinfo_plan9.go | ||
zoneinfo_read.go | ||
zoneinfo_test.go | ||
zoneinfo_unix_test.go | ||
zoneinfo_unix.go | ||
zoneinfo_windows_test.go | ||
zoneinfo_windows.go | ||
zoneinfo.go |