Skip to content

x/website: Go playground weird error #53661

@alexfrunza

Description

@alexfrunza

What is the URL of the page with the issue?

https://go.dev/play/

What is your user agent?

Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0

Screenshot

1
2

What did you do?

I was reading the Inside the Go Playground - The Go Programming Language blog, and wanted to try an example that was listed there about network. When I tried the example, more often I encountered the error that can be seen in second image, than the actual result that can be seen in the first image.

I'm sorry if it's wrong to report this issue here but I saw no option to report playground issues on the website.

Code that I tested:

package main

import (
	"io"
	"log"
	"net"
	"os"
)

func main() {
	l, err := net.Listen("tcp", "127.0.0.1:4000")
	if err != nil {
		log.Fatal(err)
	}
	defer l.Close()

	go dial()

	c, err := l.Accept()
	if err != nil {
		log.Fatal(err)
	}
	defer c.Close()

	io.Copy(os.Stdout, c)
}

func dial() {
	c, err := net.Dial("tcp", "127.0.0.1:4000")
	if err != nil {
		log.Fatal(err)
	}
	defer c.Close()
	c.Write([]byte("Hello, network\n"))
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions