-1
執行此Go程序時出現以下錯誤。不知道我錯過了什麼。「複合文字中缺少類型」錯誤
.\m.go:28: missing type in composite literal
.\m.go:28: too few values in struct initializer
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])
}
請幫助。
@skm我希望這有助於。 – 2016-08-16 03:17:56