1
0
mirror of https://github.com/golang/go synced 2024-11-17 15:44:40 -07:00

escape $WORK in ccompile when -n is set

Change-Id: I68e304e183b8bcfe314a5758ba38e2828c4b85b4
This commit is contained in:
GrigoriyMikhalkin 2020-02-18 23:37:02 +03:00
parent 1cd724acb6
commit 9e77301c7a
2 changed files with 15 additions and 3 deletions

View File

@ -2129,9 +2129,8 @@ func (b *Builder) gfortran(a *Action, p *load.Package, workdir, out string, flag
func (b *Builder) ccompile(a *Action, p *load.Package, outfile string, flags []string, file string, compiler []string) error { func (b *Builder) ccompile(a *Action, p *load.Package, outfile string, flags []string, file string, compiler []string) error {
file = mkAbs(p.Dir, file) file = mkAbs(p.Dir, file)
desc := p.ImportPath desc := p.ImportPath
if !filepath.IsAbs(outfile) { outfile = mkAbs(p.Dir, outfile)
outfile = filepath.Join(p.Dir, outfile)
}
output, err := b.runOut(a, filepath.Dir(file), b.cCompilerEnv(), compiler, flags, "-o", outfile, "-c", filepath.Base(file)) output, err := b.runOut(a, filepath.Dir(file), b.cCompilerEnv(), compiler, flags, "-o", outfile, "-c", filepath.Base(file))
if len(output) > 0 { if len(output) > 0 {
// On FreeBSD 11, when we pass -g to clang 3.8 it // On FreeBSD 11, when we pass -g to clang 3.8 it

View File

@ -0,0 +1,13 @@
[!cgo] skip
# Test that nothing is prepended to $WORK path prefix.
# See issue golang.org/issue/37012.
go build -n
! stderr '[/\\]\$WORK'
-- main.go --
package main
import "C"
var _ C.int