aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2025-06-30 17:34:01 -0400
committerCherry Mui <cherryyz@google.com>2025-07-29 12:44:58 -0700
commit25816d401c459a9dfedded3b42315a8bd2d32802 (patch)
tree16b7322d8c0628c0f7a67c67fba5ada7842f1218
parent7961bf71f8d3119ac7a886b3658966973798f426 (diff)
downloadgo-25816d401c459a9dfedded3b42315a8bd2d32802.tar.xz
internal/goexperiment: delete RangeFunc goexperiment
It is now always enabeld. The GOEXPERIMENT doesn't control anything. Remove. Change-Id: I50eb09f4537f90ec28152eb59a5a689127843fce Reviewed-on: https://go-review.googlesource.com/c/go/+/684838 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
-rw-r--r--src/cmd/compile/internal/types2/check_test.go6
-rw-r--r--src/cmd/compile/internal/types2/range.go3
-rw-r--r--src/go/types/check_test.go6
-rw-r--r--src/go/types/range.go3
-rw-r--r--src/internal/goexperiment/exp_rangefunc_off.go8
-rw-r--r--src/internal/goexperiment/exp_rangefunc_on.go8
-rw-r--r--src/internal/goexperiment/flags.go3
-rw-r--r--src/internal/trace/trace_test.go1
-rw-r--r--src/runtime/crash_test.go15
-rw-r--r--src/runtime/race/testdata/rangefunc_test.go2
-rw-r--r--src/runtime/testdata/testprog/coro.go2
-rw-r--r--src/runtime/testdata/testprogcgo/coro.go2
-rw-r--r--test/range2.go2
-rw-r--r--test/range4.go2
-rw-r--r--test/rangegen.go2
15 files changed, 6 insertions, 59 deletions
diff --git a/src/cmd/compile/internal/types2/check_test.go b/src/cmd/compile/internal/types2/check_test.go
index 35bbcec5c5..8b97a9f676 100644
--- a/src/cmd/compile/internal/types2/check_test.go
+++ b/src/cmd/compile/internal/types2/check_test.go
@@ -399,12 +399,6 @@ func TestIssue47243_TypedRHS(t *testing.T) {
}
func TestCheck(t *testing.T) {
- old := buildcfg.Experiment.RangeFunc
- defer func() {
- buildcfg.Experiment.RangeFunc = old
- }()
- buildcfg.Experiment.RangeFunc = true
-
DefPredeclaredTestFuncs()
testDirFiles(t, "../../../../internal/types/testdata/check", 50, false) // TODO(gri) narrow column tolerance
}
diff --git a/src/cmd/compile/internal/types2/range.go b/src/cmd/compile/internal/types2/range.go
index dc0d81d05b..b654601eaf 100644
--- a/src/cmd/compile/internal/types2/range.go
+++ b/src/cmd/compile/internal/types2/range.go
@@ -9,7 +9,6 @@ package types2
import (
"cmd/compile/internal/syntax"
"go/constant"
- "internal/buildcfg"
. "internal/types/errors"
)
@@ -237,7 +236,7 @@ func rangeKeyVal(check *Checker, orig Type, allowVersion func(goVersion) bool) (
assert(typ.dir != SendOnly)
return typ.elem, nil, "", true
case *Signature:
- if !buildcfg.Experiment.RangeFunc && allowVersion != nil && !allowVersion(go1_23) {
+ if allowVersion != nil && !allowVersion(go1_23) {
return bad("requires go1.23 or later")
}
// check iterator arity
diff --git a/src/go/types/check_test.go b/src/go/types/check_test.go
index 823525828a..44e4fd0104 100644
--- a/src/go/types/check_test.go
+++ b/src/go/types/check_test.go
@@ -426,12 +426,6 @@ func TestIssue47243_TypedRHS(t *testing.T) {
}
func TestCheck(t *testing.T) {
- old := buildcfg.Experiment.RangeFunc
- defer func() {
- buildcfg.Experiment.RangeFunc = old
- }()
- buildcfg.Experiment.RangeFunc = true
-
DefPredeclaredTestFuncs()
testDirFiles(t, "../../internal/types/testdata/check", false)
}
diff --git a/src/go/types/range.go b/src/go/types/range.go
index ed7d83283c..303d001c72 100644
--- a/src/go/types/range.go
+++ b/src/go/types/range.go
@@ -12,7 +12,6 @@ package types
import (
"go/ast"
"go/constant"
- "internal/buildcfg"
. "internal/types/errors"
)
@@ -240,7 +239,7 @@ func rangeKeyVal(check *Checker, orig Type, allowVersion func(goVersion) bool) (
assert(typ.dir != SendOnly)
return typ.elem, nil, "", true
case *Signature:
- if !buildcfg.Experiment.RangeFunc && allowVersion != nil && !allowVersion(go1_23) {
+ if allowVersion != nil && !allowVersion(go1_23) {
return bad("requires go1.23 or later")
}
// check iterator arity
diff --git a/src/internal/goexperiment/exp_rangefunc_off.go b/src/internal/goexperiment/exp_rangefunc_off.go
deleted file mode 100644
index fc028205db..0000000000
--- a/src/internal/goexperiment/exp_rangefunc_off.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// Code generated by mkconsts.go. DO NOT EDIT.
-
-//go:build !goexperiment.rangefunc
-
-package goexperiment
-
-const RangeFunc = false
-const RangeFuncInt = 0
diff --git a/src/internal/goexperiment/exp_rangefunc_on.go b/src/internal/goexperiment/exp_rangefunc_on.go
deleted file mode 100644
index 25e7bd361b..0000000000
--- a/src/internal/goexperiment/exp_rangefunc_on.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// Code generated by mkconsts.go. DO NOT EDIT.
-
-//go:build goexperiment.rangefunc
-
-package goexperiment
-
-const RangeFunc = true
-const RangeFuncInt = 1
diff --git a/src/internal/goexperiment/flags.go b/src/internal/goexperiment/flags.go
index 8faf3cd72c..ca99bfbb5c 100644
--- a/src/internal/goexperiment/flags.go
+++ b/src/internal/goexperiment/flags.go
@@ -100,9 +100,6 @@ type Flags struct {
// inlining phase within the Go compiler.
NewInliner bool
- // RangeFunc enables range over func.
- RangeFunc bool
-
// AliasTypeParams enables type parameters for alias types.
// Requires that gotypesalias=1 is set with GODEBUG.
// This flag will be removed with Go 1.25.
diff --git a/src/internal/trace/trace_test.go b/src/internal/trace/trace_test.go
index bd3f078f05..ce79960065 100644
--- a/src/internal/trace/trace_test.go
+++ b/src/internal/trace/trace_test.go
@@ -610,7 +610,6 @@ func testTraceProg(t *testing.T, progName string, extra func(t *testing.T, trace
buildCmd.Args = append(buildCmd.Args, "-race")
}
buildCmd.Args = append(buildCmd.Args, testPath)
- buildCmd.Env = append(os.Environ(), "GOEXPERIMENT=rangefunc")
buildOutput, err := buildCmd.CombinedOutput()
if err != nil {
t.Fatalf("failed to build %s: %v: output:\n%s", testPath, err, buildOutput)
diff --git a/src/runtime/crash_test.go b/src/runtime/crash_test.go
index 8696672065..2db86e0562 100644
--- a/src/runtime/crash_test.go
+++ b/src/runtime/crash_test.go
@@ -186,21 +186,6 @@ func buildTestProg(t *testing.T, binary string, flags ...string) (string, error)
t.Logf("running %v", cmd)
cmd.Dir = "testdata/" + binary
cmd = testenv.CleanCmdEnv(cmd)
-
- // Add the rangefunc GOEXPERIMENT unconditionally since some tests depend on it.
- // TODO(61405): Remove this once it's enabled by default.
- edited := false
- for i := range cmd.Env {
- e := cmd.Env[i]
- if _, vars, ok := strings.Cut(e, "GOEXPERIMENT="); ok {
- cmd.Env[i] = "GOEXPERIMENT=" + vars + ",rangefunc"
- edited = true
- }
- }
- if !edited {
- cmd.Env = append(cmd.Env, "GOEXPERIMENT=rangefunc")
- }
-
out, err := cmd.CombinedOutput()
if err != nil {
target.err = fmt.Errorf("building %s %v: %v\n%s", binary, flags, err, out)
diff --git a/src/runtime/race/testdata/rangefunc_test.go b/src/runtime/race/testdata/rangefunc_test.go
index 453c0733ed..986395bfb9 100644
--- a/src/runtime/race/testdata/rangefunc_test.go
+++ b/src/runtime/race/testdata/rangefunc_test.go
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build goexperiment.rangefunc
-
package race_test
import (
diff --git a/src/runtime/testdata/testprog/coro.go b/src/runtime/testdata/testprog/coro.go
index 032215b801..5f3d302987 100644
--- a/src/runtime/testdata/testprog/coro.go
+++ b/src/runtime/testdata/testprog/coro.go
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build goexperiment.rangefunc
-
package main
import (
diff --git a/src/runtime/testdata/testprogcgo/coro.go b/src/runtime/testdata/testprogcgo/coro.go
index e0cb945112..93be92cb7a 100644
--- a/src/runtime/testdata/testprogcgo/coro.go
+++ b/src/runtime/testdata/testprogcgo/coro.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build goexperiment.rangefunc && !windows
+//go:build !windows
package main
diff --git a/test/range2.go b/test/range2.go
index 6ccf1e53d8..83f19adc20 100644
--- a/test/range2.go
+++ b/test/range2.go
@@ -1,4 +1,4 @@
-// errorcheck -goexperiment rangefunc
+// errorcheck
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/range4.go b/test/range4.go
index 0b051f6d3c..e8c8da0ae3 100644
--- a/test/range4.go
+++ b/test/range4.go
@@ -1,4 +1,4 @@
-// run -goexperiment rangefunc
+// run
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
diff --git a/test/rangegen.go b/test/rangegen.go
index 8231c64db7..9d7025bd2a 100644
--- a/test/rangegen.go
+++ b/test/rangegen.go
@@ -1,4 +1,4 @@
-// runoutput -goexperiment rangefunc
+// runoutput
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style