:= is similar to var =
Setting GOPATH
export GOPATH=~/go
export PATH=$PATH:$GOPATH/bin:= slice is shallow copy
s := []string{"0", "1", "2"}
ss := s // shallow copy
sss := s[:2] // also shallow copy:= array is deep copy
s := [3]string{"0", "1", "2"}
ss := s // deep copyVerbose print
package main
import (
"fmt"
)
func main() {
type T struct {
a int
b float64
c string
}
t := T{7, -2.35, "abc\tdef"}
fmt.Printf("%#v\n", t) // prints main.T{a:7, b:-2.35, c:"abc\tdef"}
}An interface type is defined as a set of method signatures. A value of interface type can hold any value that implements those methods. Under the hood, interface values can be thought of as a tuple of a value and a concrete type: (value, type)
To get all the dependency files: go get -d ./.... The pattern ./... means start in the current directory (./) and find all packages below that directory (...).
Array always deep copies, array is just a plain memory structure, no pointer involved.
This is a good read: https://blog.golang.org/go-slices-usage-and-internals