Golang Slice Append: One or Multiple Items
Append is a basic function you need to learn when you are working with slices in golang: This example shows you three ways of appending… Read More »Golang Slice Append: One or Multiple Items
Append is a basic function you need to learn when you are working with slices in golang: This example shows you three ways of appending… Read More »Golang Slice Append: One or Multiple Items
When debugging a code it is helpful to have a way to simply print the values into the console. If you want the indention and… Read More »Print Struct as String in Golang
I wish converting from one type to another to be much easier in golang 🙂 anyway if you want to convert an int64 into a… Read More »Golang: Convert int64 to String
You want to remove duplicates from your slice, and maybe you have more than one slice to merge and get the uniques from them! Let… Read More »Golang Merge Slices Unique – Remove Duplicates
Append function in Golang uses the Variadic function then you can use three dots to spread your slice: A simple example to concatenate (merge or… Read More »How to Merge Two Slices in Golang?
If you have newlines in a string you will face an error! The simple solution is using backtick (`) around your string: Another way to… Read More »Golang How to Write Multiline String
Ok, we have a huge amount of strings to join them to each other! and maybe from different types! To concatenate strings efficiently my recommendation… Read More »Golang Concatenate Strings [Efficient Way – Builder]
Do you want to work with a repository? Do you have the repo URL? Clone command can help you to clone (copy) it into your… Read More »How to Clone Git Repository?
If you want to simply replace a string then golang has a fantastic function Replace from strings package for you: If n < 0, there… Read More »How to Replace a Substring in a String in Golang?
You need a simple way to format the output of your marshaled JSON output! Yes, Golang made it easy for us by using MarshalIndent function… Read More »How to Pretty Print JSON in Golang (Marshal Indent)