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