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

cmd/go: don't give an error for an attempt to recreate a symlink

When building for gccgo cmd/go uses symlinks for import maps.
In some cases, such as TestVendorTest, it generates the same symlink
multiple times. Don't give an error when this happens.

Change-Id: Iecc154ea1ac53d7c5427b36795881909c5cac7e3
Reviewed-on: https://go-review.googlesource.com/111636
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 2a7e19e0
......@@ -1622,6 +1622,11 @@ func (b *Builder) Mkdir(dir string) error {
// symlink creates a symlink newname -> oldname.
func (b *Builder) Symlink(oldname, newname string) error {
// It's not an error to try to recreate an existing symlink.
if link, err := os.Readlink(newname); err == nil && link == oldname {
return nil
}
if cfg.BuildN || cfg.BuildX {
b.Showcmd("", "ln -s %s %s", oldname, newname)
if cfg.BuildN {
......
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