From 3fb8b4f3db21396a69bfaa0bdbf1252214c93ecd Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Tue, 11 Mar 2025 15:09:46 -0400 Subject: [PATCH] all: move //go:debug decoratemappings=0 test to cmd/go test/decoratemappingszero.go is intended to test that //go:debug decoratemappings=0 disables annonations. Unfortunately, //go:debug processing is handled by cmd/go, but cmd/internal/testdir (which runs tests from test/) generally invokes the compiler directly, thus it does not set default GODEBUGs. Move this test to the cmd/go script tests, alongside the similar test for language version. Fixes #72772. Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64le_power10 Change-Id: I6a6a636c9d380ef984f760be5689fdc7f5cb2aeb Reviewed-on: https://go-review.googlesource.com/c/go/+/656795 Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Auto-Submit: Michael Pratt --- ...gs.txt => godebug_decoratemappings_124.txt} | 0 .../godebug_decoratemappings_comment.txt | 18 +++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) rename src/cmd/go/testdata/script/{godebug_decoratemappings.txt => godebug_decoratemappings_124.txt} (100%) rename test/decoratemappingszero.go => src/cmd/go/testdata/script/godebug_decoratemappings_comment.txt (54%) diff --git a/src/cmd/go/testdata/script/godebug_decoratemappings.txt b/src/cmd/go/testdata/script/godebug_decoratemappings_124.txt similarity index 100% rename from src/cmd/go/testdata/script/godebug_decoratemappings.txt rename to src/cmd/go/testdata/script/godebug_decoratemappings_124.txt diff --git a/test/decoratemappingszero.go b/src/cmd/go/testdata/script/godebug_decoratemappings_comment.txt similarity index 54% rename from test/decoratemappingszero.go rename to src/cmd/go/testdata/script/godebug_decoratemappings_comment.txt index 162e553405..7568812e37 100644 --- a/test/decoratemappingszero.go +++ b/src/cmd/go/testdata/script/godebug_decoratemappings_comment.txt @@ -1,14 +1,18 @@ -// run +env GO111MODULE=on -// 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. +[!GOOS:linux] skip +[short] skip -// Disable mapping annotations, which only exists for Linux. +# Programs with //go:debug decoratemappings=0 should never see annotations. +# This ensures that the runtime has not overridden the default. +go run . -//go:debug decoratemappings=0 -//go:build linux +-- go.mod -- +go 1.25 +module m +-- main.go -- +//go:debug decoratemappings=1 package main import (