mirror of
https://github.com/golang/go.git
synced 2026-04-03 09:49:56 +09:00
cmd/compile: remove loop variable capture workarounds
Since Go 1.22, loop variables have per-iteration scope, making the x := x this pattern unnecessary for goroutine capture. No issue required for this trivial cleanup. Change-Id: I00d98522537fc2b9a6b4d598c8aa21b447628d41 Reviewed-on: https://go-review.googlesource.com/c/go/+/753400 Auto-Submit: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
This commit is contained in:
committed by
Gopher Robot
parent
c29bec8a3a
commit
8da2be3cd0
@@ -41,7 +41,6 @@ func LoadPackage(filenames []string) {
|
||||
// Move the entire syntax processing logic into a separate goroutine to avoid blocking on the "sem".
|
||||
go func() {
|
||||
for i, filename := range filenames {
|
||||
filename := filename
|
||||
p := noders[i]
|
||||
sem <- struct{}{}
|
||||
go func() {
|
||||
|
||||
@@ -184,7 +184,6 @@ func main() {
|
||||
}
|
||||
var wg sync.WaitGroup
|
||||
for _, task := range tasks {
|
||||
task := task
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
task()
|
||||
|
||||
Reference in New Issue
Block a user