虽然这个看起来很简单,但我直接看傻了,各种内置类型和全局函数为啥是这样的啊,只有声明没有定义是什么情况啊。这个问题先留在这里,我知道一定在其他地方。贴出部分恐怖

    1. package builtin
    2. // bool is the set of boolean values, true and false.
    3. type bool bool
    4. // true and false are the two untyped boolean values.
    5. const (
    6. true = 0 == 0 // Untyped bool.
    7. false = 0 != 0 // Untyped bool.
    8. )
    9. // uint8 is the set of all unsigned 8-bit integers.
    10. // Range: 0 through 255.
    11. type uint8 uint8
    12. // uint16 is the set of all unsigned 16-bit integers.
    13. // Range: 0 through 65535.
    14. type uint16 uint16
    15. // uint32 is the set of all unsigned 32-bit integers.
    16. // Range: 0 through 4294967295.
    17. type uint32 uint32
    18. // uint64 is the set of all unsigned 64-bit integers.
    19. // Range: 0 through 18446744073709551615.
    20. type uint64 uint64

    顺便一说,原来还有 println 这种全局函数的。实现当然和 fmt.Println 不一样。


    再顺便,这个包解决了困扰很久的疑惑之 rune 类型

    1. // src/buildin/buildin.go ---- line 90
    2. // rune is an alias for int32 and is equivalent to int32 in all ways. It is
    3. // used, by convention, to distinguish character values from integer values.
    4. type rune = int32

    藏不住了吧,你就只是个 int32 而已,装什么神秘呢。