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.6k Golang : How to unmarshal JSON inner/nested value and assign to specific struct?
+9.6k Javascript : Read/parse JSON data from HTTP response
+21.4k Curl usage examples with Golang
+5.4k Golang : Reclaim memory occupied by make() example
+11.3k Golang : Characters limiter example
+7.1k Golang : Get environment variable
+21.2k Golang : Clean up null characters from input data
+9.7k Golang : Find correlation coefficient example
+11.1k Golang : Fix go.exe is not compatible with the version of Windows you're running
+5.4k Gogland : Datasource explorer
+5k Google : Block or disable caching of your website content
+9.4k Golang : Scramble and unscramble text message by randomly replacing words