Top "Go" questions

Go is an open-source programming language.

How to check if a map contains a key in Go?

I know I can iterate over a map m by, for k, v := range m { ... } and look for a key …

dictionary go go-map
How can I convert a zero-terminated byte array to string?

I need to read [100]byte to transfer a bunch of string data. Because not all of the strings are precisely 100 …

How to efficiently concatenate strings in go

In Go, a string is a primitive type, which means it is read-only, and every manipulation of it will create …

string go string-concatenation
How to assign string to bytes array

I want to assign string to bytes array: var arr [20]byte str := "abc" for k, v := range []byte(str) { arr[…

Is there a foreach loop in Go?

Is there a foreach construct in the Go language? Can I iterate over a slice or array using a for?

go foreach slice
How do I SET the GOPATH environment variable on Ubuntu? What file must I edit?

I am trying to do a go get: go get and it fails with the following …

linux ubuntu go
How to find the type of an object in Go?

How do I find the type of an object in Go? In Python, I just use typeof to fetch the …

go go-reflect
How do I send a JSON string in a POST request in Go

I tried working with Apiary and made a universal template to send JSON to mock server and have this code: …

json rest go apiary
How to convert an int value to string in Go?

i := 123 s := string(i) s is 'E', but what I want is "123" Please tell me how can I get "123". And …

string go int converters
What should be the values of GOPATH and GOROOT?

I'm trying to install doozer like this: $ goinstall I get these errors. goinstall: os: go/build: …

go gopath