Practical solutions

Go Howtos How-To Guides

Solve the problem. Keep building. Collection of Golang how-to articles

Find the answer you need

Browse practical solutions, grouped by the task you're working on.

__COUNT__ entries on this page

How to Send a JSON String in a POST Request in GoThis tutorial demonstrates how to send a JSON string in a POST request in Go. How to Use If-Else and Switch Loop Inside HTML Template in GolangThis tutorial demonstrates using if-else and switch loops inside HTML templates in Golang. How to Declare a Constant Map in GolangThis tutorial demonstrates how to declare a constant map in Golang. How to Catch Panics in GoThis tutorial demonstrates how to catch panics in Golang. How to Convert Interface to String in GoThis tutorial demonstrates how to convert the interface to string in Golang. How to Set Log Levels in GoThis tutorial demonstrates how to create and use log levels in Golang. How to Validate Email in GoThis tutorial demonstrates how to validate an email in Go. How to Use assert in GoThis tutorial demonstrates the use of assert in GoLang. How to Generate Random Number in GoThis tutorial demonstrates how to use random number generation functionality in GoLang. How to Compare Strings in GoThis tutorial demonstrates how to compare strings in GoLang. How to Copy Slice in GoThis tutorial demonstrates how to copy a slice in GoLang. How to Create a GUI Using Electron API in GoThis tutorial demonstrates how to create a GUI using the electron API in GoLang. How to Enable CORS in GoLangThis tutorial demonstrates how to enable and use CORS in GoLang. How to Convert JSON to Struct in GoThis tutorial demonstrates how to convert JSON to a struct in GoLang. How to Convert Struct to String in GolangThere are multiple methods and libraries that can be used to get the string representation of a struct in Go. How to Read a File Into String in GoThe ioutil.ReadFile() is a part of the ioutil library in Go to read a file. How to Create a New Directory in GoThe os.Mkdir() and os.MkdirAll() methods are part of the OS library in Go to create a new directory. How to Efficiently Read a File Line by Line in GOHow to easily and efficiently read a file line by line using the bufio package from the GO standard library How to Iterate Over an Entire Map in GoWe can iterate over an entire map by using for...range statement. How to Efficiently Concatenate Strings in GoThere are various ways of string concatenation in Go. Using built-in function copy is one of the most efficient to concatenate strings in Go How to Check if a Map Contains a Key in GoWe get two return values when we try to get the value of key in a Map. If the second value is true, then key is present on the map. How to Delete an Element From a Slice in GolangDeleting an element from a slice is quite different from other languages. Elements need to be deleted from a slice by slicing them out. How to Parse Date String in GoGo uses layout to parse a date string. Parsing is done with the help of Parse and Format functions in the time package. How to Convert an Int Value to String in GoTo convert int values to a string value, we use Itoa function from strconv package.