Commit 4439b21d authored by Hiroshi Ioka's avatar Hiroshi Ioka Committed by David Crawshaw

cmd/go: don't write file if -n option is given

Change-Id: I01f5d3b4748d0ead8642ff3e53d1ae9c4378bcbc
Reviewed-on: https://go-review.googlesource.com/61111Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent e16dc7d5
...@@ -3236,9 +3236,11 @@ func (b *Builder) gccSupportsFlag(flag string) bool { ...@@ -3236,9 +3236,11 @@ func (b *Builder) gccSupportsFlag(flag string) bool {
if cfg.BuildN || cfg.BuildX { if cfg.BuildN || cfg.BuildX {
b.Showcmd(b.WorkDir, "touch trivial.c") b.Showcmd(b.WorkDir, "touch trivial.c")
} }
src := filepath.Join(b.WorkDir, "trivial.c") if !cfg.BuildN {
if err := ioutil.WriteFile(src, []byte{}, 0666); err != nil { src := filepath.Join(b.WorkDir, "trivial.c")
return false if err := ioutil.WriteFile(src, []byte{}, 0666); err != nil {
return false
}
} }
b.flagCache = make(map[string]bool) b.flagCache = make(map[string]bool)
} }
......
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