Top "Go" questions

Go is an open-source programming language.

Get current time as formatted string in Go?

What's the best way to get the current timestamp in Go and convert to string? I need both date and …

timestamp go
In Go's http package, how do I get the query string on a POST request?

I'm using the httppackage from Go to deal with POST request. How can I access and parse the content of …

go query-string
How can I pretty-print JSON using Go?

Does anyone know of a simple way to pretty-print JSON output in Go? The stock http://golang.org/pkg/encoding/…

json go pretty-print
Convert interface{} to int

I'm trying to get a value from a JSON and cast it to int but it doesn't work, and I …

go
How to do one-liner if else statement?

Can I write a simple if-else statement with variable assignment in go (golang) as I would do in php? For …

if-statement go conditional-operator ternary
Removing packages installed with go get

I ran go get package to download a package before learning that I needed to set my GOPATH otherwise that …

go
How to split a string and assign it to variables

In Python it is possible to split a string and assign it to variables: ip, port = '127.0.0.1:5432'.split(':…

string go split
Is there a way to iterate over a range of integers?

Go's range can iterate over maps and slices, but I was wondering if there is a way to iterate over …

go
Removing fields from struct or hiding them in JSON Response

I've created an API in Go that, upon being called, performs a query, creates an instance of a struct, and …

json go
How to join a slice of strings into a single string?

package main import ( "fmt" "strings" ) func main() { reg := [...]string {"a","b","c"} fmt.Println(strings.Join(reg,",")) } gives me an …

go slice