Overview Fprintln is defined in the fmt package and is used to format a string using the default format specifier and write it to io.Writer instance passed to it. It also adds…
Tag: golang
Check if a linked list is circular in Go (Golang)
Overview Check if a linked list is circular. A linked list is circular is all nodes are connected in the form of a cylce. Program In the below program, we first create…
Convert singly linked list into a circular linked list using Go (Golang)
Overview Convert singly linked list into a circular linked list using Golang Input singly linked list: Output list that should be a circular linked list: Program There are two important methods in…
Convert singly linked list into an array using Go (Golang)
Overview Convert singly linked list into an array using Golang Input singly linked list: Output array: Program Output:
Understanding Fprint function in Go (Golang)
Overview Fprint is defined in the fmt package and is used to format a string using the default format specifier and write it to io.Writer instance passed to it. https://golang.org/pkg/fmt/#Fprint Below is…
Understanding Fprintf function in Go (Golang)
Overview Fprintf is defined in the fmt package and is used to format a string and write that formatted string to io.Writer instance passed to it as one of the arguments. https://golang.org/pkg/fmt/#Fprint…
Understanding Errorf function in Go (Golang)
Overview Errorf function is defined in the fmt package and is used to create a custom error with a formatted message as per the format specifier provided. https://golang.org/pkg/fmt/#Errorf Its main use is…
Set cookie http in Go (Golang)
Overview A cookie in golang is represented as below in golang https://golang.org/src/net/http/cookie.go See https://tools.ietf.org/html/rfc6265 for details of each of the fields of the above cookie. When it comes to the setting of…
Read cookie http in Go (Golang)
Overview net/http Request struct provides a convenient method to read a particular cookie given its name. Below is the signature of that method. https://golang.org/pkg/net/http/#Request.Cookie To print all cookies, we can iterate over the…
Cookies in Go (Golang)
What is cookie Cookies are a way to store information at the client end. The client can be a browser, a mobile application, or anything which makes an HTTP request. Cookies are…