...

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

Documentation: cmd/go/testdata/script

     1# Build something to create the executable, including several cases
     2[short] skip
     3
     4# --------------------- clean executables -------------------------
     5
     6# case1: test file-named executable 'main'
     7env GO111MODULE=on
     8
     9! exists main$GOEXE
    10go build main.go
    11exists -exec main$GOEXE
    12go clean
    13! exists main$GOEXE
    14
    15# case2: test module-named executable 'a.b.c'
    16! exists a.b.c$GOEXE
    17go build
    18exists -exec a.b.c$GOEXE
    19go clean
    20! exists a.b.c$GOEXE
    21
    22# case3: directory-named executable 'src'
    23env GO111MODULE=off
    24
    25! exists src$GOEXE
    26go build
    27exists -exec src$GOEXE
    28go clean
    29! exists src$GOEXE
    30
    31# --------------------- clean test files -------------------------
    32
    33# case1: test file-named test file
    34env GO111MODULE=on
    35
    36! exists main.test$GOEXE
    37go test -c main_test.go
    38exists -exec main.test$GOEXE
    39go clean
    40! exists main.test$GOEXE
    41
    42# case2: test module-named test file
    43! exists a.b.c.test$GOEXE
    44go test -c
    45exists -exec a.b.c.test$GOEXE
    46go clean
    47! exists a.b.c.test$GOEXE
    48
    49# case3: test directory-based test file
    50env GO111MODULE=off
    51
    52! exists src.test$GOEXE
    53go test -c
    54exists -exec src.test$GOEXE
    55go clean
    56! exists src.test$GOEXE
    57
    58-- main.go --
    59package main
    60
    61import "fmt"
    62
    63func main() {
    64	fmt.Println("hello!")
    65}
    66
    67-- main_test.go --
    68package main
    69
    70import "testing"
    71
    72func TestSomething(t *testing.T) {
    73}
    74
    75-- go.mod --
    76module example.com/a.b.c/v2
    77
    78go 1.12

View as plain text