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
As a side note, you can include the separators while splitting the string in Go. To do so, use strings.SplitAfter as in the example below.
strings.SplitAfter
package main import ( "fmt" "strings" ) func main() { fmt.Printf("%q\n", strings.SplitAfter("z,o,r,r,o", ",")) }