...

Text file src/cmd/go/testdata/script/godebug_decoratemappings_comment.txt

Documentation: cmd/go/testdata/script

     1env GO111MODULE=on
     2
     3[!GOOS:linux] skip
     4[short] skip
     5
     6# Programs with //go:debug decoratemappings=0 should never see annotations.
     7# This ensures that the runtime has not overridden the default.
     8go run .
     9
    10-- go.mod --
    11go 1.25
    12module m
    13
    14-- main.go --
    15//go:debug decoratemappings=1
    16package main
    17
    18import (
    19	"log"
    20	"os"
    21	"strings"
    22)
    23
    24func main() {
    25	b, err := os.ReadFile("/proc/self/maps")
    26	if err != nil {
    27		log.Fatalf("Error reading: %v", err)
    28	}
    29
    30	if strings.Contains(string(b), "[anon: Go:") {
    31		log.Printf("/proc/self/maps:\n%s", string(b))
    32		log.Fatalf("/proc/self/maps contains Go annotation")
    33	}
    34}

View as plain text