What does nil mean in golang?

后端 未结 7 1012
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-24 06:12

There are many cases using nil in golang. For example:

func (u *URL) Parse(ref string) (*URL, error) {
    refurl, err := Parse(ref)
    if          


        
7条回答
  •  梦毁少年i
    2020-12-24 06:48

    nil in Go means a zero value for pointers, interfaces, maps, slices, and channels. It means the value is uninitialized

提交回复
热议问题