Ian
--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
On Tue, Jul 25, 2017 at 7:37 AM, Ian Lance Taylor <ia...@golang.org> wrote:
...
> Your implicit argument about
> subdirectories seems reasonable to me. So I would support changing
> os.Chdir such that if PWD refers to the current directory, then
> os.Chdir would update PWD to refer to the new directory. Want to open
> an issue for that? https://golang.org/issue .
Ok, sounds reasonable. I just need to shift my view of the os package
and then it makes sense to teach os.Chdir to update PWD.
--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
-j
--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
An example is moot anyway isn't it? (aside from being an educational exercise)
If it doesn't matter, then why should we go through the trouble of
doing anything other than simply returning the result of
syscall.Getwd().
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
The pathname shall contain no components that are dot or dot-dot, or are symbolic links.
Inconsistency makes me sad, even when it isn't actively hurting me at the moment. Now whenever I use os.Getwd, I have to understand it will try to be smart and give me a different answer than I would intuitively expect. I think that any program that depends on this behavior is likely to be buggy as a result - what if it gets run in an environment that doesn't set PWD, or where it is not in sync with the current directory? So I also have to avoid depending on this behavior.
This conversation also led me to discover that POSIX actually requires /bin/pwd to behave this way (use PWD)! Happily GNU coreutils was enlightened enough to ignore that requirement: https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/pwd.c?id=c8ee5f19e8c697c860a5d23cd44ed300c0c222a2#n330.