From: Tobias Klauser Date: Sat, 26 Sep 2020 15:12:14 +0000 (+0200) Subject: os: remove ENOTSUP special case in Getwd on darwin X-Git-Tag: go1.16beta1~917 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=5755bad42adc23ad4a0c32149ac8cf78ece5d0b0;p=gostls13.git os: remove ENOTSUP special case in Getwd on darwin ENOTSUP was used as a signaling error in the custom implementation of syscall.Getwd to fall back to the slow algorithm. Since CL 257637 Getwd directly calls the respective function from libSystem.dylib which can no longer return ENOTSUP. Change-Id: I8e65e42b3ea069bf78969a29f2af1c55552e2949 Reviewed-on: https://go-review.googlesource.com/c/go/+/257644 Trust: Tobias Klauser Run-TryBot: Tobias Klauser TryBot-Result: Go Bot Reviewed-by: Ian Lance Taylor --- diff --git a/src/os/getwd.go b/src/os/getwd.go index f373ce937d..90604cf2f4 100644 --- a/src/os/getwd.go +++ b/src/os/getwd.go @@ -15,10 +15,6 @@ var getwdCache struct { dir string } -// useSyscallwd determines whether to use the return value of -// syscall.Getwd based on its error. -var useSyscallwd = func(error) bool { return true } - // Getwd returns a rooted path name corresponding to the // current directory. If the current directory can be // reached via multiple paths (due to symbolic links), @@ -55,9 +51,7 @@ func Getwd() (dir string, err error) { break } } - if useSyscallwd(e) { - return s, NewSyscallError("getwd", e) - } + return s, NewSyscallError("getwd", e) } // Apply same kludge but to cached dir instead of $PWD. diff --git a/src/os/getwd_darwin.go b/src/os/getwd_darwin.go deleted file mode 100644 index e51ffcd5e7..0000000000 --- a/src/os/getwd_darwin.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package os - -import "syscall" - -func init() { - useSyscallwd = useSyscallwdDarwin -} - -func useSyscallwdDarwin(err error) bool { - return err != syscall.ENOTSUP -}