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
+5.6k Golang : Configure crontab to poll every two minutes 8am to 6pm Monday to Friday
+12.5k Golang : HTTP response JSON encoded data
+12.1k Golang : convert(cast) string to integer value
+23.2k Golang : Print out struct values in string format
+17.6k Golang : Upload/Receive file progress indicator
+25.7k Golang : How to write CSV data to file
+22.4k Golang : Read directory content with filepath.Walk()
+7k Golang : Gargish-English language translator
+5.3k PHP : Hide PHP version information from curl
+10.5k Golang : Generate 403 Forbidden to protect a page or prevent indexing by search engine
+19.6k Golang : Set or Add HTTP Request Headers
+12.1k Golang : Pagination with go-paginator configuration example