2022-05-01 19:13:27 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
type dummy struct {
|
|
|
|
name string
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
fmt.Println("vim-go")
|
|
|
|
dummies := []dummy{
|
|
|
|
dummy{"foo"},
|
|
|
|
dummy{"bar"},
|
|
|
|
dummy{"baz"},
|
|
|
|
}
|
|
|
|
|
|
|
|
for i, _ := range dummies {
|
|
|
|
dum := &dummies[i]
|
|
|
|
dum.name = "hello"
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, dum := range dummies {
|
|
|
|
fmt.Println(dum.name)
|
|
|
|
}
|
|
|
|
|
2022-05-01 23:28:54 -04:00
|
|
|
foo()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func foo() {
|
|
|
|
var stuff []string
|
|
|
|
defer fmt.Println(stuff)
|
|
|
|
stuff = append(stuff, "foo")
|
|
|
|
stuff = append(stuff, "bar")
|
2022-05-01 19:13:27 -04:00
|
|
|
}
|