mirror of
https://github.com/teivah/100-go-mistakes.git
synced 2026-06-21 00:47:11 +08:00
17 lines
182 B
Go
17 lines
182 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
func main() {
|
|
s := Struct{id: "foo"}
|
|
defer s.print()
|
|
s.id = "bar"
|
|
}
|
|
|
|
type Struct struct {
|
|
id string
|
|
}
|
|
|
|
func (s Struct) print() {
|
|
fmt.Println(s.id)
|
|
}
|