I have the following code:
package main
import "net"
import "fmt"
import "bufio"
func main() {
conn, _ := net.Dial("tcp", "irc.freenode.net:6667")
reader := bufio.NewReader(conn)
go func() {
str, err := reader.ReadString('\n')
if err != nil {
// handle it
fmt.Println(err)
}
fmt.Println(str)
}()
}
If I don't have the code that reads from the buffer in a goroutine, it outputs a message like this, which is what I expect to happen:
:zelazny.freenode.net NOTICE * :*** Looking up your hostname...
However, having it inside a goroutine prints nothing.
Can someone explain why that is?
Your Answer
0 answers
Hot tools Tags
Hot Questions
What use case does pointers to pointer (eg **int) have?
2026-01-01 12:22:17
How can I remove file extension from a website address?
2026-01-01 12:01:06
$on and $broadcast in angular
2026-01-01 11:43:08
How to handle anchor hash linking in AngularJS
2026-01-01 11:22:12
MySQL 'NOT IN” query 3 tables
2026-01-01 11:01:26
Popular tool
vc9-vc14 (32+64 bit) runtime library collection (link below)
Download the collection of runtime libraries required for phpStudy installation
VC9 32-bit
VC9 32-bit phpstudy integrated installation environment runtime library
PHP programmer toolbox full version
Programmer Toolbox v1.0 PHP Integrated Environment
VC11 32-bit
VC11 32-bit phpstudy integrated installation environment runtime library
SublimeText3 Chinese version
Chinese version, very easy to use
Hot Topics
Douyin level price list 1-75
20416
7
20416
7
wifi shows no ip assigned
13574
4
13574
4
Hot Article
What is the 'basis' of a currency contract? What impact does it have on perpetual contract prices?
2025-12-26
By DDD
How to set up price alerts so you don't miss key entry points?
2026-01-01
By DDD
Tutorial on existence check of nested array values in PHP multidimensional array
2025-12-28
By DDD
How to draw dotted lines in PS How to draw various dotted lines in PS
2025-12-28
By DDD






