diff options
Diffstat (limited to 'src/cmd/go/internal/work/exec.go')
-rw-r--r-- | src/cmd/go/internal/work/exec.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go index 4840568d67..6884ad9bcc 100644 --- a/src/cmd/go/internal/work/exec.go +++ b/src/cmd/go/internal/work/exec.go @@ -546,6 +546,18 @@ func (b *Builder) build(ctx context.Context, a *Action) (err error) { return errors.New("binary-only packages are no longer supported") } + // Go 1.22 is likely to change for loop semantics. + // If we try to build code written for Go 1.22, + // it may have aliasing bugs that it shouldn't have. + // See go.dev/issue/60078. + // Go 1.19 is no longer supported, + // but we are adding this check anyway, + // just to help catch some mistakes and usage of old + // Go toolchains beyond their end-of-support. + if p.Module != nil && !(allowedVersion(p.Module.GoVersion) || p.Module.GoVersion == "1.20" || p.Module.GoVersion == "1.21") { + return errors.New("cannot compile Go " + p.Module.GoVersion + " code") + } + if err := b.Mkdir(a.Objdir); err != nil { return err } |