0
type TCustomIntType int
func aFunc() {
var fails []TCustomIntType = []TCustomIntType([]int{})
}
は、私が得た:Golangのカスタムスライスをプリミティブスライスにキャストする方法は?
cannot convert []int literal (type []int) to type []TCustomIntType
どのようにそれを修正しますか?手動でconvert funcを記述する必要がありますか?
https://golang.org/doc/faq#convert_slice_with_same_underlying_type –
ありがとうございます@CeriseLimón – tom10271
Goに_anything_をキャストできないことにご注意ください。 Goは型変換を行わず、型変換のみを行います。 – Flimzy