Golang: Convert int64 to String
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
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)
If you want to simply remove the leading and trailing white spaces from a string then forget about the regex and only use TrimSpace simple… Read More »Golang: How to Trim Whitespace and Newlines
You have a JSON in string and you want to map its values into a struct, take a look at this simple example: