There are many cases using nil in golang. For example:
func (u *URL) Parse(ref string) (*URL, error) { refurl, err := Parse(ref) if
nil is also a value but only difference is- it is empty.
In Javascript for the un-initialized variable will be undefined. In the same way Golang has nil as default value for all the un-initalized data types.