36 lines
440 B
Go
36 lines
440 B
Go
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)
|
|
}
|
|
|
|
foo()
|
|
|
|
}
|
|
|
|
func foo() {
|
|
var stuff []string
|
|
defer fmt.Println(stuff)
|
|
stuff = append(stuff, "foo")
|
|
stuff = append(stuff, "bar")
|
|
}
|