Skip to content

Commit

Permalink
cmd/{apidiff,gorelease}: use types.Alias when >= 1.23
Browse files Browse the repository at this point in the history
This module's go.mod file specifies go1.22.
These two programs use go/types, which materializes aliases as
type.Alias when the go version is >= 1.23.
Force that materialization with toolchains >= 1.23 despite what the
go.mod says.

Fixes golang/go#70695.

Change-Id: I9401d7f80880fdf59600592baf93bb4c8b7c76ec
Reviewed-on: https://go-review.googlesource.com/c/exp/+/645015
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
  • Loading branch information
jba committed Jan 28, 2025
1 parent 3edf0e9 commit e0ece0d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/apidiff/gotypesalias.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.23

//go:debug gotypesalias=1

package main

// Materialize aliases whenever the go toolchain version is after 1.23 (#69772).
// Remove this file after go.mod >= 1.23 (which implies gotypesalias=1).
4 changes: 4 additions & 0 deletions cmd/apidiff/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Command apidiff determines whether two versions of a package are compatible
package main

Expand Down
12 changes: 12 additions & 0 deletions cmd/gorelease/gotypesalias.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2025 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build go1.23

//go:debug gotypesalias=1

package main

// Materialize aliases whenever the go toolchain version is after 1.23 (#69772).
// Remove this file after go.mod >= 1.23 (which implies gotypesalias=1).

0 comments on commit e0ece0d

Please sign in to comment.