There is no optional param support in golang. But we can use variadic arguments. The function actually receives a slice of whatever type you specify.

func foo(params ...int) {
    fmt.Println(len(params))
}

func main() {
    foo()
    foo(1)
    foo(1,2,3)
    foo([]int{1, 2, 3, 4}...)
}

Support On Demand!

Golang