[Solved] panic: runtime error: index out of range 1


finally i figure this out XD!

type obj struct {
    Targets []string  `json:"targets"`
    Labels  map[string]string `json:"labels"`
}

func main() {
    // Creating simulation
    var myobj = []*obj{}
    n := new(obj)
    n.Targets = append(n.Targets, "10.0.0.1")
    n.Labels = make(map[string]string)
    n.Labels["job"] = "db2"
    myobj = append(myobj, n)
    k := new(obj)
    k.Targets = append(k.Targets, "192.168.1.12")
    k.Targets = append(k.Targets, "192.168.1.13")
    k.Labels = make(map[string]string)
    k.Labels["job"] = "mysql"
    myobj = append(myobj, k)

solved panic: runtime error: index out of range 1