Tutorials
Golang : Get download file size
Part of a good user experience is to let your users know in advance what are the next expected actions….... read more
Golang : Set and Get HTTP request headers example
Couple of examples on how to set and get HTTP request headers in Golang.
Example of setting HTTP request header.
….... read more
Linux/MacOSX : How to symlink a file?
Problem :
How to create a symbolic link for a file?
NOTE :
A symbolic link, is a low-level pointer….... read more
Golang : How to determine if request or crawl is from Google robots
For this tutorial, we will learn how to detect a visit by Google robots or web crawlers and learn how….... read more
Linux/Unix/MacOSX : Find out which application is listening to port 80 or use which IP version
Problem :
You need to find out which Linux/Unix or MacOSX applications are listening to port 80( or any other….... read more
Golang : Convert a rune to unicode style string \u
Continuing from previous tutorial on how to get escape characters or \u unicode style string. These are some….... read more
Golang : Compress and decompress file with compress/flate example
A quick and simple tutorial on how to compress a file with Golang's compress/flate
package. Package flate implements the DEFLATE….... read more
Golang : Embedded or data bundling example
Golang complies your source code into a single executable file that allows your program end users to deploy the executable….... read more
Golang : Get and Set User-Agent examples
Problem :
You want to detect User-Agent of your web application users and also setup your own User-Agent name for….... read more
Golang : Get final or effective URL with Request.URL example
There are times when we query a web server, it will re-direct internally and returns back with a slightly different….... read more
Golang : Query string with space symbol %20 in between
Problem :
You want to form URL that looks like this :
https://example.com/query?keyword="golang lookup"
but your final….... read more
Golang : Fix cannot use buffer (type bytes.Buffer) as type io.Writer(Write method has pointer receiver) error
Problem :
You created a variable of type bytes.Buffer and encounter this error message when you want to use the….... read more
Golang : Fix cannot convert buffer (type *bytes.Buffer) to type string error
Encountered these similar error messages while working on the previous tutorials on how to reset buffer and writing to http.ResponseWriter….... read more
Linux : Disable and enable IPv4 forwarding
A quick note on how to disable or enable IP (version 4) forwarding in Linux. IP forwarding is a routing….... read more
Golang : Get query string value on a POST request
In this tutorial, we will learn how to configure your Golang web application(in HTTP handler) to accept query string input….... read more
Golang : Convert(cast) bytes.Buffer or bytes.NewBuffer type to io.Reader
Problem :
You need to convert or type cast bytes.Buffer
or bytes.NewBuffer
type to io.Reader
to use in io.MultiReader()
function….... read more
Golang : Find out mime type from bytes in buffer
Problem :
You are building an application that need to detect the MIME type of an object. Such as an….... read more
Golang : Reclaim memory occupied by make() example
Problem :
You have allocated some memory for buffer via the make()
function and you want to reclaim back the….... read more