isnil

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 1 Imported by: 1

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

Documentation

Overview

Example
var p *int
var i interface{}
i = p
fmt.Printf("%v\n", i == nil)
fmt.Printf("%v\n", IsNil(i))
Output:

false
true

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNil

func IsNil(i interface{}) bool

IsNil returns true, if the inner value of i is nil otherwise false

func IsNilable

func IsNilable(obj interface {
	Kind() reflect.Kind
}) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL