I used Macbook.
I tried to use os.Chdir("/tmp")
but the outcome was /private/tmp
. Following is my code:
package main
import (
"fmt"
"os"
)
func main() {
s, _ := os.Getwd()
fmt.Println(s)
if err := os.Chdir("/tmp"); err != nil {
panic(err)
}
s, _ = os.Getwd()
fmt.Println(s)
}
And the output is:
➜ test go run main.go
/Users/willy/test
/private/tmp
Why?