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
+12.4k Elastic Search : Return all records (higher than default 10)
+7.1k Golang : Get environment variable
+8.3k Golang : Oanda bot with Telegram and RSI example
+9.2k Golang : How to check if a string with spaces in between is numeric?
+19.2k Golang : Populate dropdown with html/template example
+15.6k Golang : Validate hostname
+19.1k Mac OSX : Homebrew and Golang
+23.1k Golang : simulate tail -f or read last line from log file example
+10.6k Golang : How to unmarshal JSON inner/nested value and assign to specific struct?
+15k Golang : package is not in GOROOT during compilation
+9.5k Golang : Convert(cast) string to int64