以程序导入gotest/even包为例
package main import ( "even" "fmt" ) func main() { i:=even.I fmt.Printf("Is %d even? %v\n", i, even.Even(i)) }
package even var I int = 123 func Even(i int) bool { return i%2==0 } func odd(i int) bool { return i%2!=0 }
fmt.Printf("Is %d even? %v\n", i, even.odd(i))
main.go:10: cannot refer to unexported name even.odd
type S struct {T1 //字段名字是 T1*T2 //字段名字是 T2P.T3 //字段名字是 T3x, y int //字段名字是 x 和 y}
原文:http://blog.csdn.net/typ2004/article/details/41604655