Hello . I have multiple struct types , all fields seems filled properly but 1 , and i have no idea why value displays 0 when i put 1 in param.
package main
import (
"fmt"
)
type convFlow struct {
conFlowData []*userData
//choices []*choice
}
type convMessage struct {
botMsg int
userMsg int
}
//ConvChat general info about chat user
type userData struct {
userID int
state int
msgIDs *convMessage
userName string
userFname string
userLastName string
}
func (data *convFlow) addData(userID int, state int, botMsg, userMsg int, userName, userFname, userLastName string) {
usr := &userData{
userID: userID,
msgIDs: &convMessage{
botMsg: botMsg,
userMsg: userMsg,
},
userName: userName,
userFname: userFname,
userLastName: userLastName,
}
data.conFlowData = append(data.conFlowData, usr)
}
func main() {
start := new(convFlow)
start.addData(222314, 1, 12, 13, "@Brandon", "John", "Don")
for _, dt := range start.conFlowData {
fmt.Println(dt.state)
}
}
any idea why it shows 0 instead 1