Top "Go" questions

Go is an open-source programming language.

How do I import a specific version of a package using go get?

coming from a Node environment I used to install a specific version of a vendor lib into the project folder (…

go package package-managers
How to get the last element of a slice?

What is the Go way for extracting the last element of a slice? var slice []int slice = append(slice, 2) slice = …

go slice
Convert byte slice to io.Reader

In my project, I have a byte slice from a request's response. defer resp.Body.Close() if resp.StatusCode != http.…

go
Organizing a multiple-file Go project

Note: this question is related to this one, but two years is a very long time in Go history. What …

go
Iterate through the fields of a struct in Go

Basically, the only way (that I know of) to iterate through the values of the fields of a struct is …

go go-reflect
Go / golang time.Now().UnixNano() convert to milliseconds?

How can I get Unix time in Go in milliseconds? I have the following function: func makeTimestamp() int64 { return time.…

time go unix-timestamp date-conversion
Make a URL-encoded POST request using `http.NewRequest(...)`

I want to make a POST request to an API sending my data as a application/x-www-form-urlencoded content type. Due …

http go
How to import local packages in go?

I am new to go and working on an example code that I want to localize. In the original main.…

go
How do I compare strings in GoLang?

I am unable to produce a 'true' result when it comes to Go string comparison. I wrote the following to …

go
How to install the current version of Go in Ubuntu Precise

Running sudo apt-get install golang-stable, I get Go version go1.0.3. Is there any way to install go1.1.1?

ubuntu go