Quick actions

cmd+k|ctrl+k

Navigation

Languages

Reflection / Primitive types / Essential Go

Snippet info

Language

Go

Visibility

public

Author

kkowalczyk

Created

2019-03-26T10:16:54Z

Updated

2019-03-26T10:16:54Z

package main

import (
	"fmt"
	"reflect"
)

func getIntValue(v interface{}) {
	var reflectValue = reflect.ValueOf(v)
	n := reflectValue.Int()
	fmt.Printf("Int value is: %d\n", n)
}

func main() {
	getIntValue(3)
	getIntValue(int8(4))
	getIntValue("")
}
INFO