Discover Packages
gitlab.com/golang-utils/isnil
package
module
Version:
v1.0.1
Opens a new window with list of versions in this module.
Published: Aug 17, 2024
License: MIT
Opens a new window with license information.
Imports: 1
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
README
README
¶
isnil
Simple helpers to deal with nil values in go
Example
package main
import (
"fmt"
. "gitlab.com/golang-utils/isnil"
)
func main() {
var p *int
var i interface{}
i = p
fmt.Printf("%v\n", i == nil) // prints false
fmt.Printf("%v\n", IsNil(i)) // prints true
}
Documentation
see http://pkg.go.dev/gitlab.com/golang-utils/isnil
Expand ▾
Collapse ▴
Documentation
¶
var p *int
var i interface{}
i = p
fmt.Printf("%v\n", i == nil)
fmt.Printf("%v\n", IsNil(i))
Output:
false
true
func IsNil(i interface{}) bool
IsNil returns true, if the inner value of i is nil
otherwise false
Source Files
¶
Click to show internal directories.
Click to hide internal directories.