Golang fmt.GoStringer type example
package fmt
GoStringer is implemented by any value that has a GoString method, which defines the Go syntax for that value. The GoString method is used to print values passed as an operand to a %#v format.
Golang fmt.GoStringer type usage example
func deepPrint(b *bytes.Buffer, v reflect.Value) {
i := v.Interface()
t := v.Type()
// GoStringer
if g, ok := i.(fmt.GoStringer); ok {
b.WriteString(g.GoString())
return
}
...
Reference :
Advertisement
Something interesting
Tutorials
+10.1k Golang : Print how to use flag for your application example
+22.6k Generate checksum for a file in Go
+20.7k Android Studio : AlertDialog and EditText to get user string input example
+87.8k Golang : How to convert character to ASCII and back
+6.4k Golang : Break string into a slice of characters example
+20.8k Golang : Convert date string to variants of time.Time type examples
+8.3k Swift : Convert (cast) Character to Integer?
+5.3k PHP : Hide PHP version information from curl
+13.1k Golang : How to get a user home directory path?
+6.1k PageSpeed : Clear or flush cache on web server
+25k Golang : Create PDF file from HTML file
+36.5k Golang : Validate IP address