Golang fmt.Fprintln() function examples
package fmt
Fprintln formats using the default formats for its operands and writes to w. Spaces are always added between operands and a newline is appended. It returns the number of bytes written and any write error encountered.
Golang fmt.Fprintln() function usage examples
Example 1 :
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
<-c
fmt.Fprintln(os.Stderr, "\nReceived second interrupt. Shutting down.")
os.Exit(1)
Example 2 :
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello World! ")
})
Reference :
Advertisement
Something interesting
Tutorials
+32.7k Golang : Regular Expression for alphanumeric and underscore
+15k Golang : How do I get the local IP (non-loopback) address ?
+17.6k Golang : delete and modify XML file content
+15.3k Golang : Get all local users and print out their home directory, description and group id
+9k Golang : Go as a script or running go with shebang/hashbang style
+19.1k Golang : Display list of time zones with GMT
+6.1k Golang : How to write backslash in string?
+8.4k Golang : Convert word to its plural form example
+9.4k Golang : Generate EAN barcode
+10.7k Golang : Underscore string example
+5k Google : Block or disable caching of your website content
+8.5k Linux/Unix : fatal: the Postfix mail system is already running