-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wanted
Milestone
Description
(Edit: skip down to #70284 (comment); this is now a doc change request. --@adonovan)
Go version
go version go1.23.1 darwin/amd64
Output of go env
in your module/workspace:
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/Users/haaawk/Library/Caches/go-build'
GOENV='/Users/haaawk/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/haaawk/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/haaawk/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='go1.23.1'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/Users/haaawk/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/_y/nj5hcsh93l12tmsszxgx7ntr0000gn/T/go-build2396141927=/tmp/go-build -gno-record-gcc-switches -fno-common'
What did you do?
When following code is run:
package main
import (
"runtime"
"golang.org/x/sync/errgroup"
)
func main() {
runtime.GOMAXPROCS(1)
g := &errgroup.Group{}
g.SetLimit(1)
ch := make(chan struct{})
wait := make(chan struct{}, 2)
g.Go(func() error {
<-ch
wait <- struct{}{}
return nil
})
go g.Go(func() error {
println("I'm not blocked")
wait <- struct{}{}
return nil
})
println("Ok let's play")
close(ch)
g.Wait()
println("It's over already?")
<-wait
<-wait
}
https://go.dev/play/p/xTIsT1iouTd
What did you see happen?
The program printed:
Ok let's play
It's over already?
I'm not blocked
What did you expect to see?
The program printing:
Ok let's play
I'm not blocked
It's over already?
Metadata
Metadata
Assignees
Labels
DocumentationIssues describing a change to documentation.Issues describing a change to documentation.NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.help wanted