i’ve struct with value and I run with loop to update value, while debug the code
I see that it enter to the case lines like element.Type = "cccc”
but after the loop exit when I look
at ftr the old value exist and its not updated, what am I missing here ?
ftr := FTR{}
err = yaml.Unmarshal([]byte(yamlFile), &ftr)
for index, element := range ftr.Mod{
switch element.Type {
case “aaa”, “bbbb”:
element.Type = "cccc”
case "htr”:
element.Type = "com"
case "no":
element.Type = "jnodejs"
case "jdb”:
element.Type = "tomcat"
}
}
This is the struct
type FTR struct {
Id string
Mod []Mod
}
type Mod struct {
Name string
Type string
}