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

     1  env 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.
     8  go run .
     9  
    10  -- go.mod --
    11  go 1.25
    12  module m
    13  
    14  -- main.go --
    15  //go:debug decoratemappings=1
    16  package main
    17  
    18  import (
    19  	"log"
    20  	"os"
    21  	"strings"
    22  )
    23  
    24  func 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  }
    35  

View as plain text