Commit e7ec06e0 authored by Ian Lance Taylor's avatar Ian Lance Taylor

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: default avatarDaniel Martí <mvdan@mvdan.cc>
Reviewed-by: default avatarRuss Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent aa153879
......@@ -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"`)
}
......@@ -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.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment