Created
June 9, 2015 22:59
-
-
Save calavera/6953dbaecb887e55298b to your computer and use it in GitHub Desktop.
links.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"os" | |
"path/filepath" | |
) | |
func main() { | |
tmp, _ := ioutil.TempDir("", "test-") | |
os.Mkdir(tmp+"foo", 0755) | |
l, err := os.Readlink(tmp + "foo") | |
fmt.Println(err) | |
fmt.Println(l) | |
l, err = filepath.EvalSymlinks(tmp + "foo") | |
fmt.Println(err) | |
fmt.Println(l) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
calavera@d /tmp $ go run links.go | |
readlink /var/folders/js/2dvhvjgs3h90tyjb3t7c23cw0000gn/T/test-698304347foo: invalid argument | |
<nil> | |
/private/var/folders/js/2dvhvjgs3h90tyjb3t7c23cw0000gn/T/test-698304347foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment