This question already has an answer here:
- Missing type in composite literal 1 answer
I am getting the following error, while executing this Go program. not sure what I am missing.
.\m.go:28: missing type in composite literal
.\m.go:28: too few values in struct initializer
<kbd>Go Playground</kbd>
package main
import (
"fmt"
)
type LI struct {
Id int `json:"id"`
}
type TP struct {
Name string `json:"name"`
Value string `json:"value"`
}
type LTI struct {
Leads []LI `json:"leads"`
Tokens []TP `json:"tokens,omitempty"`
}
type RCR struct {
Input LTI `json:"input"`
}
func main() {
fmt.Println("Hello, playground")
leadIdInput := LI{Id: 55213}
leadTokensInput := LTI{{[]LI{leadIdInput}, nil}}
rCR := RCR{Input: leadTokensInput}
fmt.Println("rCR is '%+v'", rCR.Input.Leads[0])
}
Please help.
</div>