golang中什么样的类型可以赋值nil? 类型文档中有注定"uninitialized value is nil"的类型都可以赋值nil.

golang的基本类型不能赋值nil:

    bool

    int

    uint

    float

    complex

    byte

    rune

    string

    struct

golang的非基本类型都能赋值nil:

    array

    slice

    map

    chan

    func

    interface

golang的指针类型也能赋值nil:

    pointer

其中struct令我最费解

相关文章:

  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
  • 2022-12-23
  • 2023-02-08
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-23
  • 2022-12-23
  • 2021-06-20
  • 2022-12-23
  • 2021-10-30
  • 2020-05-20
  • 2022-12-23
相关资源
相似解决方案