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
+13.5k Facebook PHP getUser() returns 0
+30.4k Golang : How to verify uploaded file is image or allowed file types
+11.5k CodeIgniter : Import Linkedin data
+7.7k Golang : get the current working directory of a running program
+5.4k Python : Delay with time.sleep() function example
+9.5k Mac OSX : Get a process/daemon status information
+16.3k Golang : How to extract links from web page ?
+7.4k Android Studio : How to detect camera, activate and capture example
+18.6k Golang : Get download file size
+33k Golang : How to check if a date is within certain range?
+12.7k Golang : Send data to /dev/null a.k.a blackhole with ioutil.Discard
+17.9k Golang : Qt image viewer example