Skip to content

Instantly share code, notes, and snippets.

@azhuox

azhuox/block1.go Secret

Created December 1, 2020 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azhuox/d1c9fa6273aa11c087fb304ed395fe7d to your computer and use it in GitHub Desktop.
Save azhuox/d1c9fa6273aa11c087fb304ed395fe7d to your computer and use it in GitHub Desktop.
package main
func main() {
// Use `nil` as zero values
_ = interface{}(nil)
_ = (*struct{})(nil) // () around *struct{} is necessary, otherwise Go will not be able to know where `*` points to.
_ = string[](nil)
_ = map[string]int(nil)
_ = chan string(nil)
_ =(func())(nil) // () around func() is necessary
// This lines are equivalent to the above lines
var _ interface{} = nil
var _ *struct{} = nil
var _ string[] = nil
var _ map[string]int = nil
var _ chan string = nil
var _ func() = nil
// This lines are equivalent to the above lines, as `nil` is default values of these types
var _ interface{}
var _ *struct{}
var _ string[]
var _ map[string]int
var _ chan string
var _ func()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment