1
0
mirror of https://github.com/golang/go synced 2024-11-24 04:00:13 -07:00

cmd/go: copy FFLAGS from build.Package

Fixes #18975.

Change-Id: I60dfb299233ecfed4b2da93750ea84e7921f1fbb
Reviewed-on: https://go-review.googlesource.com/36482
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ian Lance Taylor 2017-02-07 07:28:49 -08:00
parent aa15387996
commit e7ec06e000
2 changed files with 22 additions and 0 deletions

View File

@ -3777,3 +3777,24 @@ func TestA(t *testing.T) {}`)
tg.grepStdout("pkgs$", "expected package not listed")
tg.grepStdout("pkgs/a", "expected package not listed")
}
// Issue 18975.
func TestFFLAGS(t *testing.T) {
if !canCgo {
t.Skip("skipping because cgo not enabled")
}
tg := testgo(t)
defer tg.cleanup()
tg.parallel()
tg.tempFile("p/src/p/main.go", `package main
// #cgo FFLAGS: -no-such-fortran-flag
import "C"
func main() {}
`)
tg.tempFile("p/src/p/a.f", `! comment`)
tg.setenv("GOPATH", tg.path("p"))
tg.runFail("build", "-x", "p")
tg.grepStderr("no-such-fortran-flag", `missing expected "-no-such-fortran-flag"`)
}

View File

@ -184,6 +184,7 @@ func (p *Package) copyBuild(pp *build.Package) {
p.CgoCFLAGS = pp.CgoCFLAGS
p.CgoCPPFLAGS = pp.CgoCPPFLAGS
p.CgoCXXFLAGS = pp.CgoCXXFLAGS
p.CgoFFLAGS = pp.CgoFFLAGS
p.CgoLDFLAGS = pp.CgoLDFLAGS
p.CgoPkgConfig = pp.CgoPkgConfig
// We modify p.Imports in place, so make copy now.