Skip to content

tour: Goroutine inconsistent output #1719

Open
@myerspliers

Description

@myerspliers

Context: https://go.dev/tour/concurrency/1

Looking at the code, I would expect the output to have "hello" and "world" each printed five times. Most of the time it does, but sometimes "world" is only printed 4 times. I'm guessing the goroutine ends as soon as main exits, before "world" can print the last time, or something like that.

This behavior should be explained, or the example code should be changed so this doesn't happen.

I assume the browser doesn't matter for the "tour", but I saw this in both Firefox and Chrome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions