对这种 [class news name age] 返回什么类型啊

hellsam · · 1045 次点击
[]string{} ? string 的 slice ?
#4
更多评论
说实话,不明白你在说啥,能多提供些上下文信息吗
#1
~~~ <a href="/user/channel" title="@channel">@channel</a> API返回的是[class news name age] 这种类型 还是必须只能用interface{} 接收,用字符串就报错了 无奈啊, 不知道如何处理了。 这样一个条件也不满足了 type TaskTest int const ( _ TaskTest = iota a b c ) func main() { var ss2 TaskTest ss2, _ = GetStatus() fmt.Println(ss2) //结果我这里永远都是返回0 , switch永远不匹配 } func GetStatus() (status TaskTest, err error) { result := &#34;b&#34; //这个我固定了,默认是API地址 我以为返回一个字符 如a b c结果返回如:[class news name age] //是一个 interface{} 也无法转换string switch result { case &#34;a&#34;: status = a case &#34;b&#34;: status = b case &#34;c&#34;: status = c } return status ,nil } ~~~
#2