Reverse Function for String in Golang?
Yes, a string is a slice then you can iterate over it easily. Take a look at this snippet which helps you to reverse a… Read More »Reverse Function for String in Golang?
Yes, a string is a slice then you can iterate over it easily. Take a look at this snippet which helps you to reverse a… Read More »Reverse Function for String in Golang?
If you want to check the equality of two slices and the order is important then this snippet will save your time:
There are two concepts to learn: empty and nil. Some variables can be nil, for example, a pointer can be nil and if you do… Read More »Golang: When a Variable Can Be nil? (invalid memory address)
You are facing an error that says you are not using the correct type, a slice of string! Yes, you are sending an array (which… Read More »Go Error: Argument Problem for strings.Join
Some functions need a slice ([]string, []int, …) but you have an array (for example: [3]string, [10]int). Converting an array is as easy as calling… Read More »How to Convert an Array Into a Slice in Go
Finding a minimum number between a list of numbers is not hard but most of the min functions compare only between two numbers. Here we… Read More »Get Minimum Number From a Slice In Golang
Let’s create a function that can accept multiple numbers and return the maximum number from them. In Golang, it is easy as pie and you… Read More »Golang How to Calc Max Int Function (Slice or Any Number Input)
Dear math package has a very good set of constants that help you do your job with confidence. You can use Max or Min constants:… Read More »Golang: Number Types Maximum and Minimum Value (Limit Values)
If you want to have a custom key (for example uppercased, lowercased, or even a new name) on the JSON marshal output in golang use… Read More »Golang JSON Marshal With Custom Key (Lowercase, Uppercase …)
time package is your friend if you want to have different durations in golang! Duration has int64 type then you can multiply it with int64… Read More »How to Multiply a Duration by an Integer?