In Python it is possible to split a string and assign it to variables:
ip, port = \'127.0.0.1:5432\'.split(\':\')
but in Go it does not see
Golang does not support implicit unpacking of an slice (unlike python) and that is the reason this would not work. Like the examples given above, we would need to workaround it.
One side note:
The implicit unpacking happens for variadic functions in go:
func varParamFunc(params ...int) {
}
varParamFunc(slice1...)