Standard library / time

time.Time.GoString()

Return a Go-syntax representation for debugging, used by fmt with %#v. It is not a stable serialization format. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (t Time) GoString() string

Return Value

string

Return a Go-syntax representation for debugging, used by fmt with %#v.

Working Example

Example Snippetgo
package main
import (  "fmt"  "time")
func fixed() time.Time { return time.Date(2024, 2, 29, 12, 34, 56, 123000000, time.UTC) }func main()            { fmt.Println(fixed().GoString() == fmt.Sprintf("%#v", fixed())) }
Go Reference