What is actualily changing directory?

A thought crossed my mind ten minutes ago and I’m bored on my phone (and no laptop). When I do an os.Chdir(“…/”), what is actually changing directory? Is it the goroutine that the function was called for? Is it the entire executable? If I start a goroutine, change to a different directory, then call Getcwd from the main goroutine, will it say the original dir or the new one?

it’s easy to test.
func os.Chdir apply to the whole process , main and other groutine alive and in progress,so it say new dir

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.