Source file src/runtime/testdata/testsuid/main.go

     1  // Copyright 2023 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  import (
     8  	"fmt"
     9  	"log"
    10  	"os"
    11  )
    12  
    13  func main() {
    14  	if os.Geteuid() == os.Getuid() {
    15  		os.Exit(99)
    16  	}
    17  
    18  	fmt.Fprintf(os.Stdout, "GOTRACEBACK=%s\n", os.Getenv("GOTRACEBACK"))
    19  	f, err := os.OpenFile(os.Getenv("TEST_OUTPUT"), os.O_CREATE|os.O_RDWR, 0600)
    20  	if err != nil {
    21  		log.Fatalf("os.Open failed: %s", err)
    22  	}
    23  	defer f.Close()
    24  	fmt.Fprintf(os.Stderr, "hello\n")
    25  }
    26  

View as plain text