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
+22.3k Golang : Read directory content with filepath.Walk()
+27.6k PHP : Convert(cast) string to bigInt
+8k Golang : What fmt.Println() can do and println() cannot do
+8.4k Golang : Ackermann function example
+14.1k Golang : Check if a file exist or not
+7.5k Golang : Gorrila set route name and get the current route name
+5.9k Facebook : How to force facebook to scrape latest URL link data?
+19.5k Golang : How to Set or Add Header http.ResponseWriter?
+17.6k Golang : Upload/Receive file progress indicator
+14.5k How to automatically restart your crashed Golang server
+6.6k Golang : Totalize or add-up an array or slice example