Overview HTTP client in golang lets you specify a CookieJar that manages storing and sending of the cookies while making external HTTP requests. As the name suggests, think of it as a…
Tag: golang
Println vs Print vs Printf in Go (Golang)
Overview Println, Print, and Printf are defined in the fmt package and are used to format a string and write to standard output https://golang.org/pkg/fmt/ The basic difference between them is Println formats…
Golang Regex – Include dot – ‘.’ inside square brackets or character class
Overview Dot or ‘.’ is treated as a literal character inside the square brackets or character class. It doesn’t need to be escaped inside that. Let’s see a working program for the…
Write to write or print backslash in a string in Go (Golang)
Overview Backlash is an escaping character. To print a backslash we need to first escape is with another backslash character when using double-quotes. However, a backslash can also be printed using backquotes….
Conversion between float32 and float64 in Go (Golang)
Overview Golang requires explicit conversion to convert from one type to the other. Conversion between float32 and float64 data type requires explicit type conversion. Below is the syntax for that. This converts some_value…
Convert int to float in Go (Golang)
Overview Golang requires explicit conversion to convert from one type to the other. An int data type can directly be converted into float data type using explicit type conversion. Below is the syntax for…
Convert float to int in Go (Golang)
Overview Golang requires explicit conversion to convert from one type to the other. The float data type can directly be converted into float data type using explicit type conversion. Below is the…
Pause Execution of a goroutine until an activity or event is completed in Go (Golang)
Overview Channels can be used to pause the execution of a goroutine until an activity is completed. For a Unbuffered Channel Goroutine will block on send operation if there is no other…
How to access the struct from another package in Go (Golang)
Overview The struct name in another package must start with a capital letter so that it is public outside its package. If the struct name starts with lowercase then it will not…
How to call a function from another package in Go (Golang)
Overview The function in another package must start with a capital letter so that it is public outside its package. If the function name starts with lowercase then it will not be…