Top "Go" questions

Go is an open-source programming language.

Go: panic: runtime error: invalid memory address or nil pointer dereference

When running my Go program, it panics and returns the following: panic: runtime error: invalid memory address or nil pointer …

go
How to delete an element from a Slice in Golang

fmt.Println("Enter position to delete::") fmt.Scanln(&pos) new_arr := make([]int, (len(arr) - 1)) k := 0 for i := 0; …

go
How to handle configuration in Go

I'm new at Go programming, and I'm wondering: what is the preferred way to handle configuration parameters for a Go …

go configuration-files
How to multiply duration by integer?

To test concurrent goroutines, I added a line to a function to make it take a random time to return (…

go time
The maximum value for an int type in Go

How does one specify the maximum value representable for an unsigned integer type? I would like to know how to …

numbers go
How to set default values in Go structs

There are multiple answers/techniques to the below question: How to set default values to golang structs? How to initialize …

go struct initialization default-value
How to run test cases in a specified file?

My package test cases are scattered across multiple files, if I run go test <package_name> it runs …

go
nil detection in Go

I see a lot of code in Go to detect nil, like this: if err != nil { // handle the error } however, …

go null
List directory in Go

I've been trying to figure out how to simply list the files and folders in a single directory in Go. …

go
Convert a float64 to an int in Go

How does one convert a float64 to an int in Go? I know the strconv package can be used to …

go