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
+25k Golang : Create PDF file from HTML file
+4.7k JavaScript: Add marker function on Google Map
+5.3k Golang : Generate Interleaved 2 inch by 5 inch barcode
+22.2k Golang : Print leading(padding) zero or spaces in fmt.Printf?
+16.9k Golang : Get the IPv4 and IPv6 addresses for a specific network interface
+9.9k Golang : Translate language with language package example
+11.6k Golang : Display a text file line by line with line number example
+12.4k Golang : Extract part of string with regular expression
+9.8k Golang : Format strings to SEO friendly URL example
+14k Golang : Fix cannot use buffer (type bytes.Buffer) as type io.Writer(Write method has pointer receiver) error
+34.1k Golang : Create x509 certificate, private and public keys