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
+11.9k Golang : Convert(cast) bigint to string
+33.9k Golang : Call a function after some delay(time.Sleep and Tick)
+13.2k Golang : How to calculate the distance between two coordinates using Haversine formula
+12.7k Golang : zlib compress file example
+11.3k Golang : Characters limiter example
+19.5k Golang : How to Set or Add Header http.ResponseWriter?
+22.2k Golang : How to run Golang application such as web server in the background or as daemon?
+16.3k Golang : convert string or integer to big.Int type
+5.3k Javascript : Shuffle or randomize array example
+13.9k Golang : Get current time
+8k Golang : Handle Palindrome string with case sensitivity and unicode