I want to call a function in Go, and attach to the argument values the argument names
func sum(a int, b int) int {
return a + b
}
func main() {
result := sum(a=4, b=5) // result == 9
}
Is it possible?
There is no such thing like named arguments in go
At the moment Go does not have a way to use named argument in functions. If you really need to use named arguments you can try this library go-named-params