Golang fmt.Scanner type example
package fmt
Scanner is implemented by any value that has a Scan method, which scans the input for the representation of a value and stores the result in the receiver, which must be a pointer to be useful. The Scan method is called for any argument to Scan, Scanf, or Scanln that implements it.
Golang fmt.Scanner type usage example
var arg interface{}
var err error
var verb rune
var s fmt.ScanState
// If the parameter has its own Scan method, use that.
if v, ok := arg.(Scanner); ok {
err = v.Scan(s, verb)
if err != nil {
if err == io.EOF {
err = io.ErrUnexpectedEOF
}
}
Reference :
Advertisement
Something interesting
Tutorials
+6.3k Apt-get to install and uninstall Golang
+17k Golang : Covert map/slice/array to JSON or XML format
+12.2k Linux : How to install driver for 600Mbps Dual Band Wifi USB Adapter
+37.5k Golang : Converting a negative number to positive number
+16.8k Golang : read gzipped http response
+13.6k Android Studio : Password input and reveal password example
+4.6k Mac OSX : Get disk partitions' size, type and name
+22.2k Golang : Print leading(padding) zero or spaces in fmt.Printf?
+21.2k Golang : How to force compile or remove object files first before rebuild?
+9.4k Golang : Generate EAN barcode
+14.2k Golang : Fix image: unknown format error