[英]Function will not return multiple returns - multiple-value in single-value context
Go refuses to return multiple returns. Go拒绝返回多个退货。 If I leave out the second return it works but I need the second return.
如果我没有第二次退货,它可以工作,但我需要第二次退货。 How do I resolve?
我该如何解决?
Here is my call: 这是我的电话:
type Streaming struct{}
func main() {
mySlice, dateList = getHgetallStreamingData()
}
Here is my function: 这是我的功能:
func getHgetallStreamingData(pair string, c redis.Conn) ([]Streaming, []time.Time) {
var mySlice []Streaming
var dateList []time.Time
return mySlice, dateList
}
Here is my error: 这是我的错误:
multiple-value getHgetallStreamingData() in single-value context
The error must be coming from somewhere else. 该错误必须来自其他地方。 The code works like a charm:
该代码就像一个魅力:
package main
import "time"
type Streaming struct{}
func main() {
_, _ = getHgetallStreamingData()
}
func getHgetallStreamingData() (s []Streaming, t []time.Time) {
return
}
playground . 操场 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.