...

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

Documentation: cmd/go/testdata/script

     1[!cgo] skip
     2
     3# Require that CC is something that requires a PATH lookup.
     4# Normally, the default is gcc or clang, but if CC was set during make.bash,
     5# that becomes the default.
     6[!cc:clang] [!cc:gcc] skip 'C compiler is not gcc or clang'
     7
     8env GOCACHE=$WORK/gocache  # Looking for compile flags, so need a clean cache.
     9[!GOOS:windows] env PATH=.:$PATH
    10[!GOOS:windows] chmod 0755 p/gcc p/clang
    11[!GOOS:windows] exists -exec p/gcc p/clang
    12[GOOS:windows] exists -exec p/gcc.bat p/clang.bat
    13! exists p/bug.txt
    14! go build -x
    15stderr '^cgo: C compiler "(clang|gcc)" not found: exec: "(clang|gcc)": cannot run executable found relative to current directory'
    16! exists p/bug.txt
    17
    18-- go.mod --
    19module m
    20
    21-- m.go --
    22package m
    23
    24import _ "m/p"
    25
    26-- p/p.go --
    27package p
    28
    29// #define X 1
    30import "C"
    31
    32-- p/gcc --
    33#!/bin/sh
    34echo ran gcc >bug.txt
    35-- p/clang --
    36#!/bin/sh
    37echo ran clang >bug.txt
    38-- p/gcc.bat --
    39echo ran gcc >bug.txt
    40-- p/clang.bat --
    41echo ran clang >bug.txt

View as plain text