What benefits arise from naming a function's return parameter(s)? func namedReturn(i int) (ret int) { ret = i i += 2 return } func anonReturn(i in
Here's an issue that's bedeviling me at the moment. When getting input from the user, I want to employ a loop to ask the user to retry until they enter valid in
I am pretty new to go and I was playing with this notify package. At first I had code that looked like this: func doit(w http.ResponseWriter, r *http.Request)
I just need a pointer to time.Time, so the code below seems invalid: ./c.go:5: cannot take the address of time.Now() I just wonder why? Is there any way t
I'm trying to bulk remove objects in minio as described here: objectsCh := make(chan minio.ObjectInfo) // Send object names that are needed to be removed to ob
I'm looking for the best way to calculate execution time in go. func main() { start := time.Now() time.Sleep(time.Second * 2) //something doing he
Does Go have something similar to Python's in keyword? I want to check if a value is in a list. For example in Python: x = 'red' if x in ['red', 'green', 'ye
Currently I am having an issue related to assign a Golang variable to a Javascript variable. I am using the Golang templates, so, from the backend I sent a JSON
I have a empty file called a.txt, I want to output a value(int) to it in a loop, and overwrite last content in file a.txt. For example, // open a file
I have tried: const ascii = "abcdefghijklmnopqrstuvwxyz" const letter_goodness []float32 = { .0817,.0149,.0278,.0425,.1270,.0223,.0202, .0609,.0697,.0015,.0077
For example, I have a string, consists of "sample.zip". How do I remove the ".zip" extension using strings package or other else?
I have a weird issue that arose when I took a break from this project. Upon starting up Goland, I'm riddled with errors when trying to run my project. The spe
Is there a StartsWith(str1, str2 string) function that can check if str1 is a prefix of str2 in Go language? I want a function similar to the Java's startsWith
I'm trying to debug the following build error in our CI where "A depends on B which can't build because it depends on C." I'm building my data service which doe
In Go, you can marshall a struct to XML, e.g.: package main import ( "encoding/xml" "fmt" ) type person struct { Name string Starsign str
I'm pretty new to Golang and I have an issue with adding items to Array. I use this link as a reference golang-book. I have this struct: package models type Fi
To my knowledge go distribution comes with some sort of package manager. After go 1.4.1 installation I've run go help in order to find any sub-command capable o
I'm trying to write a basic go program that calls a function on a different file, but a part of the same package. However, it returns: undefined: NewEmployee
Is there a way to download a large file using Go that will store the content directly into a file instead of storing it all in memory before writing it to a fil
Looking at the set up for go-vcr // Start our recorder r, err := recorder.New("fixtures/etcd") if err != nil { log.Fatal(err) } defer r.