Articles by Tuan Nguyen
Golang array contains specific element or not? [SOLVED]
In this tutorial we have covered different examples to cover golang array contains elements. Use for loop to check for string, int or float64 element in array …
Golang length of map [2 Easy Methods]
use two different methods to get golang length of map. Using len() function or iterate over the map elements and count each occurence to get the length.
Golang iterate over Array [2 Methods]
There are two possible methods in golang to iterate over an array using for loop with range function or with len(array) function
Golang print type of an object [SOLVED]
In this tutorial we covered golang print type of an object using string formatting, go reflect package and type assertions
Golang sha256 Hashing Examples
golang sha256 hashing examples to hash a string of text or an entire file using sha256 function
Convert Golang Interface to String [7 Methods]
golang interface to string conversion is not supported directly but we can use type assertion or fmt.Sprintf to do the type casting
Golang generate random string Examples [SOLVED]
Multiple examples covering golang generate random string using rand function. Generate alphanumeric, special characters, uppercase, lowercase strings
GO Import struct from another file [SOLVED]
You can use import to import the package and then reference the struct using package.StructName wherein the name of Struct must start with Capital letters to …
Golang Bool to String Type Casting [2 Methods]
There are 2 methods to convert golang bool to string type. We can use FormatBool() function or Sprintf() function for the type casting
Golang Compare String PROPERLY [3 Methods]
golang compare strings using comparision operators, compare() method or equalof() method
Golang Tabs vs Space for indentation - Formatting Tips
The official recommendation is to use golang TABs for indentation and formatting. We can format go code automatically using go fmt or goimports command
Is golang tuple possible? [SOLVED]
By design golang tuple is not possible but we can work around this by using interfaces and generics.
Golang Timing - RIGHT way to measure execution time in GO
We explained two methods to achieve golang timing to measure execution time of go code using time function
Check if Key Exists in GO Map [6 Proven Methods]
We will explore following methods to check if key exists in map in golang. terate over map elements and look out for the key, Using index expression, Perform a …
What the Hell is Golang Anonymous Structs? How to Use it?
Explore the dynamic world of Golang Anonymous Structs! Dive into this insightful guide to uncover powerful strategies, avoid common pitfalls, and harness the …
