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

     1  [short] skip 'runs go build'
     2  
     3  # First run: executable for bar is not cached.
     4  # Make sure it's not called a.out
     5  go tool bar
     6  stdout 'my name is: bar'$GOEXE
     7  ! stdout 'a.out'
     8  
     9  # Second run: executable is cached. Make sure it
    10  # has the right name.
    11  go tool bar
    12  stdout 'my name is: bar'$GOEXE
    13  ! stdout 'a.out'
    14  
    15  -- go.mod --
    16  module example.com/foo
    17  
    18  go 1.24
    19  
    20  tool example.com/foo/bar
    21  -- bar/bar.go --
    22  package main
    23  
    24  import (
    25  	"fmt"
    26  	"os"
    27  	"path/filepath"
    28  )
    29  
    30  func main() {
    31  	fmt.Println("my name is:", filepath.Base(os.Args[0]))
    32  }

View as plain text