diff --git a/src/os/file_windows.go b/src/os/file_windows.go index 0d3c048a759..a2cb96e4573 100644 --- a/src/os/file_windows.go +++ b/src/os/file_windows.go @@ -365,17 +365,14 @@ func Symlink(oldname, newname string) error { flags |= syscall.SYMBOLIC_LINK_FLAG_DIRECTORY } err = syscall.CreateSymbolicLink(n, o, flags) - if err != nil { // the unprivileged create flag is unsupported // below Windows 10 (1703, v10.0.14972). retry without it. flags &^= windows.SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE - err = syscall.CreateSymbolicLink(n, o, flags) - } - - if err != nil { - return &LinkError{"symlink", oldname, newname, err} + if err != nil { + return &LinkError{"symlink", oldname, newname, err} + } } return nil }