reflect.MakeChan() Function in Golang with Examples Last Updated : 28 Apr, 2020 Comments Improve Suggest changes Like Article Like Report Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.MakeChan() Function in Golang is used to create a new channel with the specified type and buffer size. To access this function, one needs to imports the reflect package in the program. Syntax: func MakeChan(typ Type, buffer int) Value Parameters: This function takes only two parameters of Type type(typ) and int type (buffer). Return Value: This function returns the newly created channel. Below examples illustrate the use of above method in Golang: Example 1: C // Golang program to illustrate // reflect.MakeChan() Function package main import ( "fmt" "reflect" ) // Main function func main() { var val chan int // create new channel value := reflect.MakeChan(reflect.Indirect(reflect.ValueOf(&val)).Type(), 0) fmt.Println("Value :", value) } Output: Value : 0xc00005e060 Example 2: C // Golang program to illustrate // reflect.MakeChan() Function package main import ( "fmt" "reflect" ) // Main function func main() { var val chan string var strVal reflect.Value = reflect.ValueOf(&val) indirectStr := reflect.Indirect(strVal) // create new channel value := reflect.MakeChan(indirectStr.Type(), 1024) fmt.Printf("Type : [%v] \nCapacity : [%v]", value.Kind(), value.Cap()) } Output: Type : [chan] Capacity : [1024] Comment More infoAdvertise with us Next Article reflect.MakeChan() Function in Golang with Examples S SHUBHAMSINGH10 Follow Improve Article Tags : Go Language Golang-reflect Similar Reads reflect.MakeMap() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package.The reflect.MakeMap() Function in Golang is used to create a new map with the specified type. To access this function, one nee 2 min read reflect.MakeFunc() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package.The reflect.MakeFunc() Function in Golang is used to get the new function of the given Type that wraps the function fn. To acc 2 min read reflect.MakeSlice() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package.The reflect.MakeSlice() Function in Golang is used to create new zero-initialized slice value for the specified slice type, le 2 min read reflect.MapKeys() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.MapKeys() Function in Golang is used to get a slice containing all the keys present in the map, in unspecified or 2 min read reflect.Len() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.Len() Function in Golang is used to get the v's length. To access this function, one needs to imports the reflect 1 min read Like