Related questions
Why can't a string be nil in Go?
The program available on The Go Playground reads
package main
import "fmt"
func main() {
var name string = nil
fmt.Println(name)
}
and yields an error
prog.go:6: cannot use nil as type string in assignment
I understand "" is the "zero …
var vs := in Go
In the Go web server example here: http://golang.org/doc/effective_go.html#web_server
The following line of code works
var addr = flag.String("addr", ":1718", "http service address")
but changing it to
addr := flag.String("addr", ":1718", "http service …
Golang mixed assignment and declaration
I started working with go for a few weeks, and (once again) I stumbled across something that seems odd for me:
// Not working
a := 1
{
a, b := 2, 3
}
// Works
a := 1
a, b := 2, 3
playground
I want to assign two variables simultaneously.
One is …