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
+14k Golang : convert rune to unicode hexadecimal value and back to rune character
+6.8k Golang : Calculate pivot points for a cross
+21.9k Golang : Use TLS version 1.2 and enforce server security configuration over client
+9.4k Facebook : Getting the friends list with PHP return JSON format
+21.8k Golang : Upload big file (larger than 100MB) to AWS S3 with multipart upload
+18.5k Golang : Aligning strings to right, left and center with fill example
+15.9k Golang : Read a file line by line
+7.1k Golang : A simple forex opportunities scanner
+7.2k Golang : Use modern ciphers only in secure connection
+8.6k Python : Fix SyntaxError: Non-ASCII character in file, but no encoding declared