In this Golang code, I have a variable called developers
which is equal to two slices. I want them to be equal to one slice as shown in the required result.
Although I could do it by writing it in a single slice like this {"first developer", "second developer"},
but I want to write them separately and print them as one but to be considered as multiple entities like this [[first developer second developer]...]
Given result
[[first developer] [second developer] [first project second project] [third project forth project]]
Required result
[[first developer second developer] [first project second project] [third project forth project]]
Code
package main
import "fmt"
func main() {
developers := [][]string{
{"first developer"},
{"second developer"},
}
var data [][]string
for i := 0; i < 2; i++ {
data = append(data, developers[i])
}
data = append(data, [][]string{
{"first project", "second project"},
{"third project", "forth project"},
}...)
fmt.Println(data)
}