最近发布的主题
最近发布的文章
暂无
最近分享的资源
暂无
最近发布的项目
暂无
最近的评论
-
评论了主题 怎么实现真正的goroutine超时?```go package main import ( "fmt" "time" ) const timeoutSecond = time.Second * 5 func handleTask() <-chan string { //receive channel ch := make(chan string) go func() { time.Sleep(time.Second * 6) //mock produce time-consuming ch <- "Finish" }() return ch } func main() { for { select { case msg := <-handleTask(): fmt.Print(msg) case <-time.After(timeoutSecond): fmt.Print("Timeout") return } } } ```
-
评论了主题 复杂的json数据怎么像python一样读取啊
-
评论了主题 goland大家有这个问题吗>试试这个:http://idea.iteblog.com/key.php
-
**看下面代码,或许对你有启发** ```go func main(){ var student Student println(&student) for i:=0;i<2;i++{ var stu Student println(&stu) stu.Key=strconv.Itoa(i) student=stu println(&student) } } ``` > 0xc420039f38 > 0xc420039f58 > 0xc420039f38 > 0xc420039f58 > 0xc420039f38 ```go func main(){ var student *Student println(&student) for i:=0;i<2;i++{ var stu Student println(&stu) stu.Key=strconv.Itoa(i) student=&stu println(student) } } ``` > 0xc420039f68 > 0xc42000a500 > 0xc42000a500 > 0xc42000a520 > 0xc42000a520
-
学习学习!