It is necessary to add some data to the empty structure, I tried different options, but it did not help. Data is added successfully if the structure contains a simple array. I’m new to Golang. Sample code below
package main
import "fmt"
type Data struct {
Arr []struct {
Key1 string
Key2 string
}
}
func main() {
var data Data
fmt.Println(data)
}
I tried to add it through append, I tried it through for. I expected that the structure contained the following set
{“Arr”:[{“Key1″:”value1″,”Key2″:”value2”}]}
New contributor
Losenmann is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.