[tools] x/tools: remove explicit setting godebug gotypesalias

3 views
Skip to first unread message

qiu laidongfeng (Gerrit)

unread,
Jan 4, 2026, 7:05:46 AMJan 4
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

qiu laidongfeng has uploaded the change for review

Commit message

x/tools: remove explicit setting godebug gotypesalias

godebug=gotypesalias=1 already the default value,
Continuing with explicit setting will prevent
CL 727160 from delete this godebug.

For golang/go#76472
Change-Id: I9283d260a77c648d89a12a748131d0cefcbd161c

Change diff

diff --git a/go/callgraph/vta/vta_test.go b/go/callgraph/vta/vta_test.go
index 42610ab..3c99797 100644
--- a/go/callgraph/vta/vta_test.go
+++ b/go/callgraph/vta/vta_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:debug gotypesalias=1
-
package vta

import (
diff --git a/go/packages/packages_test.go b/go/packages/packages_test.go
index 5a3ba1e..9c6b65b 100644
--- a/go/packages/packages_test.go
+++ b/go/packages/packages_test.go
@@ -3142,8 +3142,6 @@
testenv.NeedsTool(t, "go") // requires go list.
testenv.NeedsGoBuild(t) // requires the compiler for export data.

- t.Setenv("GODEBUG", "gotypesalias=1")
-
dir := t.TempDir()
overlay := map[string][]byte{
filepath.Join(dir, "go.mod"): []byte("module m"), // go version of the module does not matter.
diff --git a/go/ssa/builder_test.go b/go/ssa/builder_test.go
index 084ed3e..9bd999d 100644
--- a/go/ssa/builder_test.go
+++ b/go/ssa/builder_test.go
@@ -1114,7 +1114,6 @@
cmd := exec.Command(os.Args[0], "-test.run=TestGenericAliases")
cmd.Env = append(os.Environ(),
"GENERICALIASTEST_CHILD=1",
- "GODEBUG=gotypesalias=1",
)
if testenv.Go1Point() == 23 {
cmd.Env = append(cmd.Env, "GOEXPERIMENT=aliastypeparams")
diff --git a/go/types/objectpath/objectpath_test.go b/go/types/objectpath/objectpath_test.go
index 642d6da..c93c157 100644
--- a/go/types/objectpath/objectpath_test.go
+++ b/go/types/objectpath/objectpath_test.go
@@ -26,17 +26,6 @@
)

func TestPaths(t *testing.T) {
- for _, aliases := range []int{0, 1} {
- t.Run(fmt.Sprint(aliases), func(t *testing.T) {
- testPaths(t, aliases)
- })
- }
-}
-
-func testPaths(t *testing.T, gotypesalias int) {
- // override default set by go1.22 in go.mod
- t.Setenv("GODEBUG", fmt.Sprintf("gotypesalias=%d", gotypesalias))
-
const src = `
-- go.mod --
module x.io
diff --git a/gopls/internal/test/marker/testdata/hover/hover.txt b/gopls/internal/test/marker/testdata/hover/hover.txt
index 92ebfeb..c6d1736 100644
--- a/gopls/internal/test/marker/testdata/hover/hover.txt
+++ b/gopls/internal/test/marker/testdata/hover/hover.txt
@@ -36,7 +36,6 @@
}
}
-- cmd/main.go --
-//go:debug gotypesalias=0

// Note that since GODEBUG shows only settings that differ from
// the current toolchain, the output here depends on the toolchain used.
diff --git a/gopls/internal/test/marker/testdata/modfile/godebug.txt b/gopls/internal/test/marker/testdata/modfile/godebug.txt
index 49fab9b..b212e94 100644
--- a/gopls/internal/test/marker/testdata/modfile/godebug.txt
+++ b/gopls/internal/test/marker/testdata/modfile/godebug.txt
@@ -10,9 +10,9 @@
go 1.23

godebug (
- gotypesalias=0
+ http2server=0
)
-godebug gotypesalias=1
+godebug http2server=1

-- a/a.go --
package a
@@ -30,14 +30,14 @@
module example.com/m/format //@format(formatted)

godebug (
-gotypesalias=0
+http2server=0
)
-godebug gotypesalias=1
+godebug http2server=1
-- @formatted --
module example.com/m/format //@format(formatted)

godebug (
- gotypesalias=0
+ http2server=0
)

-godebug gotypesalias=1
+godebug http2server=1
diff --git a/gopls/internal/test/marker/testdata/modfile/godebug_bad.txt b/gopls/internal/test/marker/testdata/modfile/godebug_bad.txt
index 1b26f60..37da705 100644
--- a/gopls/internal/test/marker/testdata/modfile/godebug_bad.txt
+++ b/gopls/internal/test/marker/testdata/modfile/godebug_bad.txt
@@ -14,4 +14,3 @@
godebug (
gotypealias=0 // misspelled
)
-godebug gotypesalias=1
diff --git a/gopls/internal/test/marker/testdata/workfile/godebug.txt b/gopls/internal/test/marker/testdata/workfile/godebug.txt
index 68fd0f2..5c893cb 100644
--- a/gopls/internal/test/marker/testdata/workfile/godebug.txt
+++ b/gopls/internal/test/marker/testdata/workfile/godebug.txt
@@ -10,9 +10,9 @@
use .

godebug (
- gotypesalias=0
+ http2server=0
)
-godebug gotypesalias=1
+godebug http2server=1

-- a/go.mod --
module example.com/a
@@ -37,9 +37,9 @@
use .

godebug (
-gotypesalias=0
+http2server=0
)
-godebug gotypesalias=1
+godebug http2server=1

-- @formatted --
go 1.23 //@format(formatted)
@@ -47,10 +47,10 @@
use .

godebug (
- gotypesalias=0
+ http2server=0
)

-godebug gotypesalias=1
+godebug http2server=1
-- format/go.mod --
module example.com/format

diff --git a/gopls/internal/test/marker/testdata/workfile/godebug_bad.txt b/gopls/internal/test/marker/testdata/workfile/godebug_bad.txt
index 98a0dd2..17fb988 100644
--- a/gopls/internal/test/marker/testdata/workfile/godebug_bad.txt
+++ b/gopls/internal/test/marker/testdata/workfile/godebug_bad.txt
@@ -14,7 +14,6 @@
godebug (
gotypealias=0 // misspelled
)
-godebug gotypesalias=1

-- go.mod --
module example.com/m //@diag("module", re`unknown godebug "gotypealias"`)
diff --git a/internal/aliases/aliases_test.go b/internal/aliases/aliases_test.go
index 54b5bc8..eaef801 100644
--- a/internal/aliases/aliases_test.go
+++ b/internal/aliases/aliases_test.go
@@ -43,41 +43,24 @@
t.Fatalf("Eval(%s) failed: %v", expr, err)
}

- for _, godebug := range []string{
- // Note: previously there was a test case for "", which asserted on the
- // behavior implied by the x/tools go.mod go directive. But that only works
- // if x/tools is the main module for the test, which isn't the case when
- // run with a go.work file, or from another module (golang/go#70082).
- "gotypesalias=0",
- "gotypesalias=1",
- } {
- t.Run(godebug, func(t *testing.T) {
- t.Setenv("GODEBUG", godebug)
+ enabled := aliases.Enabled()

- enabled := aliases.Enabled()
+ A := aliases.NewAlias(enabled, token.NoPos, pkg, "A", tv.Type, nil)
+ if got, want := A.Name(), "A"; got != want {
+ t.Errorf("Expected A.Name()==%q. got %q", want, got)
+ }

- A := aliases.NewAlias(enabled, token.NoPos, pkg, "A", tv.Type, nil)
- if got, want := A.Name(), "A"; got != want {
- t.Errorf("Expected A.Name()==%q. got %q", want, got)
- }
+ if got, want := A.Type().Underlying(), tv.Type; got != want {
+ t.Errorf("Expected A.Type().Underlying()==%q. got %q", want, got)
+ }
+ if got, want := types.Unalias(A.Type()), tv.Type; got != want {
+ t.Errorf("Expected Unalias(A)==%q. got %q", want, got)
+ }

- if got, want := A.Type().Underlying(), tv.Type; got != want {
- t.Errorf("Expected A.Type().Underlying()==%q. got %q", want, got)
- }
- if got, want := types.Unalias(A.Type()), tv.Type; got != want {
- t.Errorf("Expected Unalias(A)==%q. got %q", want, got)
- }
-
- wantAlias := godebug == "gotypesalias=1"
- _, gotAlias := A.Type().(*types.Alias)
- if gotAlias != wantAlias {
- verb := "to be"
- if !wantAlias {
- verb = "to not be"
- }
- t.Errorf("Expected A.Type() %s a types.Alias(). got %q", verb, A.Type())
- }
- })
+ _, gotAlias := A.Type().(*types.Alias)
+ if !gotAlias {
+ verb := "to not be"
+ t.Errorf("Expected A.Type() %s a types.Alias(). got %q", verb, A.Type())
}
}

@@ -93,7 +76,6 @@
testenv.NeedsGoExperiment(t, "aliastypeparams")
}

- t.Setenv("GODEBUG", "gotypesalias=1") // needed until gotypesalias is removed (1.27) or enabled by go.mod (1.23).
enabled := aliases.Enabled()
if !enabled {
t.Fatal("Need materialized aliases enabled")
diff --git a/internal/facts/facts_test.go b/internal/facts/facts_test.go
index 0b4ea73..619cef6 100644
--- a/internal/facts/facts_test.go
+++ b/internal/facts/facts_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:debug gotypesalias=1
-
package facts_test

import (
diff --git a/internal/gcimporter/gcimporter_test.go b/internal/gcimporter/gcimporter_test.go
index 749253b..565a626 100644
--- a/internal/gcimporter/gcimporter_test.go
+++ b/internal/gcimporter/gcimporter_test.go
@@ -175,16 +175,6 @@

testAliases(t, func(t *testing.T) {
var skip map[string]string
-
- // Add tests to skip.
- if testenv.Go1Point() == 22 && os.Getenv("GODEBUG") == aliasesOn {
- // The tests below can be skipped in 1.22 as gotypesalias=1 was experimental.
- // These do not need to be addressed.
- skip = map[string]string{
- "struct.go": "1.22 differences in formatting a *types.Alias",
- "issue50259.go": "1.22 cannot compile due to an understood types.Alias bug",
- }
- }
testImportTypeparamTests(t, skip)
})
}
@@ -930,8 +920,6 @@
testenv.NeedsGoBuild(t) // to find stdlib export data in the build cache
skipWindows(t)

- t.Setenv("GODEBUG", aliasesOn)
-
tmpdir := mktmpdir(t)
defer os.RemoveAll(tmpdir)
testoutdir := filepath.Join(tmpdir, "testdata")
@@ -1026,22 +1014,10 @@
}
}

-const (
- aliasesOff = "gotypesalias=0" // default GODEBUG in 1.22 (like x/tools)
- aliasesOn = "gotypesalias=1" // default after 1.23
-)
-
// testAliases runs f within subtests with the GODEBUG gotypesalias enables and disabled.
func testAliases(t *testing.T, f func(*testing.T)) {
- for _, dbg := range []string{
- aliasesOff,
- aliasesOn,
- } {
- t.Run(dbg, func(t *testing.T) {
- t.Setenv("GODEBUG", dbg)
- f(t)
- })
- }
+ // TODO: remove this function.
+ f(t)
}

type importMap map[string]*types.Package
diff --git a/internal/gcimporter/iexport_test.go b/internal/gcimporter/iexport_test.go
index fa8ecd3..9a05174 100644
--- a/internal/gcimporter/iexport_test.go
+++ b/internal/gcimporter/iexport_test.go
@@ -429,8 +429,6 @@
testenv.NeedsGoExperiment(t, "aliastypeparams") // testenv.Go1Point() >= 24 implies aliastypeparams=1
}

- t.Setenv("GODEBUG", aliasesOn)
-
// High level steps:
// * parse and typecheck
// * export the data for the importer (via IExportData),
diff --git a/internal/typeparams/free_test.go b/internal/typeparams/free_test.go
index 5ba2779..3faf107 100644
--- a/internal/typeparams/free_test.go
+++ b/internal/typeparams/free_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:debug gotypesalias=1
-
package typeparams

import (
diff --git a/internal/typesinternal/zerovalue_test.go b/internal/typesinternal/zerovalue_test.go
index ca1e28b..528dfe9 100644
--- a/internal/typesinternal/zerovalue_test.go
+++ b/internal/typesinternal/zerovalue_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:debug gotypesalias=1
-
package typesinternal_test

import (

Change information

Files:
  • M go/callgraph/vta/vta_test.go
  • M go/packages/packages_test.go
  • M go/ssa/builder_test.go
  • M go/types/objectpath/objectpath_test.go
  • M gopls/internal/test/marker/testdata/hover/hover.txt
  • M gopls/internal/test/marker/testdata/modfile/godebug.txt
  • M gopls/internal/test/marker/testdata/modfile/godebug_bad.txt
  • M gopls/internal/test/marker/testdata/workfile/godebug.txt
  • M gopls/internal/test/marker/testdata/workfile/godebug_bad.txt
  • M internal/aliases/aliases_test.go
  • M internal/facts/facts_test.go
  • M internal/gcimporter/gcimporter_test.go
  • M internal/gcimporter/iexport_test.go
  • M internal/typeparams/free_test.go
  • M internal/typesinternal/zerovalue_test.go
Change size: M
Delta: 15 files changed, 29 insertions(+), 98 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I9283d260a77c648d89a12a748131d0cefcbd161c
Gerrit-Change-Number: 733880
Gerrit-PatchSet: 1
Gerrit-Owner: qiu laidongfeng <26454...@qq.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

qiu laidongfeng (Gerrit)

unread,
Jan 4, 2026, 7:06:09 AMJan 4
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

qiu laidongfeng voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I9283d260a77c648d89a12a748131d0cefcbd161c
Gerrit-Change-Number: 733880
Gerrit-PatchSet: 1
Gerrit-Owner: qiu laidongfeng <26454...@qq.com>
Gerrit-Reviewer: qiu laidongfeng <26454...@qq.com>
Gerrit-Comment-Date: Sun, 04 Jan 2026 12:06:03 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Alan Donovan (Gerrit)

unread,
Apr 28, 2026, 5:45:27 PM (12 hours ago) Apr 28
to qiu laidongfeng, goph...@pubsubhelper.golang.org, Zvonimir Pavlinovic, Michael Matloob, Robert Findley, Gopher Robot, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
Attention needed from Zvonimir Pavlinovic and qiu laidongfeng

Alan Donovan added 2 comments

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Alan Donovan . resolved

One last thing, but otherwise looks good. Thanks.

File internal/gcimporter/gcimporter_test.go
Line 1019, Patchset 1 (Latest): // TODO: remove this function.
Alan Donovan . unresolved

Would you mind inlining all calls? Thanks.

Open in Gerrit

Related details

Attention is currently required from:
  • Zvonimir Pavlinovic
  • qiu laidongfeng
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: tools
    Gerrit-Branch: master
    Gerrit-Change-Id: I9283d260a77c648d89a12a748131d0cefcbd161c
    Gerrit-Change-Number: 733880
    Gerrit-PatchSet: 1
    Gerrit-Owner: qiu laidongfeng <26454...@qq.com>
    Gerrit-Reviewer: Alan Donovan <adon...@google.com>
    Gerrit-Reviewer: Zvonimir Pavlinovic <zpavl...@google.com>
    Gerrit-Reviewer: qiu laidongfeng <26454...@qq.com>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-CC: Michael Matloob <mat...@golang.org>
    Gerrit-CC: Robert Findley <rfin...@golang.org>
    Gerrit-Attention: qiu laidongfeng <26454...@qq.com>
    Gerrit-Attention: Zvonimir Pavlinovic <zpavl...@google.com>
    Gerrit-Comment-Date: Tue, 28 Apr 2026 21:45:21 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    qiu laidongfeng (Gerrit)

    unread,
    3:45 AM (2 hours ago) 3:45 AM
    to goph...@pubsubhelper.golang.org, Alan Donovan, Zvonimir Pavlinovic, Michael Matloob, Robert Findley, Gopher Robot, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com

    qiu laidongfeng abandoned this change.

    View Change

    Abandoned This CL has been superseded by CL 736860

    qiu laidongfeng abandoned this change

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: abandon
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages