Golang interface type

interface type

--Types compatible with all types --Something like the Object class ――Since it is a general-purpose representation of all types of values, you cannot perform operations.

main.go


package main

import (
    "fmt"
)

func main() {
    var x interface{}
    fmt.Printf("%#v", x)
}

When output, it becomes . 0 is set as the initial value in the int type, but it is nil in the interface type.

$ go run main.go 
<nil>

Recommended Posts

Golang interface type
Dictionary type 2
Dictionary type 1
golang profiling