If you have worked with time/date formatting in other languages you might have noticed that the other languages use special placeholders for time/date formatting. For eg ruby language uses %d for day…
Author: admin
Current Timestamp in Go (Golang)
Overview In this tutorial, we will see how to get the current timestamp using the time package in Go. The current time can be represented in different ways time.Time object Unix Time…
Get age given a DOB in Go (Golang)
This tutorial will talk about how given a date of birth we can compute the age of a person. go-age comes to our rescue for doing that. It also takes into account…
Understanding Rune in Golang
Overview rune in Go is an alias for int32 meaning it is an integer value. This integer value is meant to represent a Unicode Code Point. To understand rune you have to know…
Understanding uintptr in Golang
Overview This is an unsigned integer type which is large enough to hold any pointer address. Therefore its size is platform dependent. It is just an integer representation of an address. Properties…
Represent Date of Birth in Go (Golang)
time.Date function of time package can be used to create a particular date that can represent a DOB. See below example getDOB is the function that takes in a year, month and…
Append to an existing file in Go (Golang)
os.OpenFile() function of the os package can be used to open to a file in an append mode and then write to it Let’s see an example. In the below program: First,…
Touch a file in Go (Golang)
Touching a file means Create an empty file if the file doesn’t already exist If the file already exists then update the modified time of the file. Output: When running the first…
Get Current Working Directory in Go (Golang)
os.Getwd() is used to get the current working directory. Output will similar to pwd command on linux Output: Current Working Direcoty: <will be current working directory on the machine>
Iterate over all files and folders for a path in Go (Golang)
‘Walk’ function of ‘filepath’ package can be used to recursively iterate over all files/folder in a directory tree. ‘Walk’ function will walk the entire tree rooted at the root path include all…