mirror of
https://github.com/golang/go
synced 2024-11-26 04:27:58 -07:00
cmd/go: escape $WORK in ccompile when -n is set
Fixes #37012
Change-Id: I169807788c022042a2b5cf04f67ae41a7325fbcf
GitHub-Last-Rev: 9e77301c7a
GitHub-Pull-Request: golang/go#37289
Reviewed-on: https://go-review.googlesource.com/c/go/+/219919
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
975c01342a
commit
8992f7c459
@ -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 {
|
||||
file = mkAbs(p.Dir, file)
|
||||
desc := p.ImportPath
|
||||
if !filepath.IsAbs(outfile) {
|
||||
outfile = filepath.Join(p.Dir, outfile)
|
||||
}
|
||||
outfile = mkAbs(p.Dir, outfile)
|
||||
|
||||
output, err := b.runOut(a, filepath.Dir(file), b.cCompilerEnv(), compiler, flags, "-o", outfile, "-c", filepath.Base(file))
|
||||
if len(output) > 0 {
|
||||
// On FreeBSD 11, when we pass -g to clang 3.8 it
|
||||
|
13
src/cmd/go/testdata/script/build_n_cgo.txt
vendored
Normal file
13
src/cmd/go/testdata/script/build_n_cgo.txt
vendored
Normal 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
|
Loading…
Reference in New Issue
Block a user