You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\username\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=E:\libs;E:\projects
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\username\AppData\Local\Temp\go-build715944026=/tmp/go-build -gno-record-gcc-switches
What did you do?
here is the code:
package main
import (
"fmt""sync"
)
funcmain() {
var (
iintwg sync.WaitGroup
)
wg.Add(2)
gofunc() {
for {
i++
}
}()
gofunc() {
for {
fmt.Println(i)
}
}()
wg.Wait()
}
my computer has 4 logic cpu, so these two goroutines may both have opportunity to run, but unfortunately, what was printed is always 0.
What did you expect to see?
print different value of i
What did you see instead?
always print 0
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
here is the code:
my computer has 4 logic cpu, so these two goroutines may both have opportunity to run, but unfortunately, what was printed is always 0.
What did you expect to see?
print different value of
i
What did you see instead?
always print 0
The text was updated successfully, but these errors were encountered: