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

     1  # go build with -o and -buildmode=exe should report an error on a non-main package.
     2  
     3  ! go build -buildmode=exe -o out$GOEXE ./not_main
     4  stderr '-buildmode=exe requires exactly one main package'
     5  ! exists out$GOEXE
     6  ! go build -buildmode=exe -o out$GOEXE ./main_one ./main_two
     7  stderr '-buildmode=exe requires exactly one main package'
     8  ! exists out$GOEXE
     9  
    10  -- go.mod --
    11  module m
    12  
    13  go 1.16
    14  -- not_main/not_main.go --
    15  package not_main
    16  
    17  func F() {}
    18  -- main_one/main_one.go --
    19  package main
    20  
    21  func main() {}
    22  -- main_two/main_two.go --
    23  package main
    24  
    25  func main() {}
    26  

View as plain text