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
+8k Golang : Handle Palindrome string with case sensitivity and unicode
+9k Golang : Build and compile multiple source files
+14.5k Golang : Rename directory
+15k Golang : Search folders for file recursively with wildcard support
+22.7k Golang : Strings to lowercase and uppercase example
+12.3k Golang : Print UTF-8 fonts on image example
+5.8k Linux : Disable and enable IPv4 forwarding
+8.7k Golang : Combine slices but preserve order example
+12.2k Golang : calculate elapsed run time
+7k Web : How to see your website from different countries?
+11.9k Golang : Setup API server or gateway with Caddy and http.ListenAndServe() function example