I have struct, the structure like below:
package main
import "fmt"
type Data [][]struct {
Message string `json:"message"`
Status string `json:"status"`
}
func main() {
d := Data{
{{message, "Halo"}, {status, "Active"}},
}
fmt.Println(d)
}
$ go run arr.go
# command-line-arguments
.\arr.go:12:5: undefined: message
.\arr.go:12:24: undefined: status
I want to get fields "Message" and "Status" to send back to the response. My question is How can I initialize the struct and accessing its fields? But I gon an error.