Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os: Stat("symlink").Name() doesn't return correct name on windows #20064

Closed
hirochachacha opened this issue Apr 21, 2017 · 1 comment
Closed

os: Stat("symlink").Name() doesn't return correct name on windows #20064

hirochachacha opened this issue Apr 21, 2017 · 1 comment

Comments

@hirochachacha
Copy link
Contributor

@hirochachacha hirochachacha commented Apr 21, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

What operating system and processor architecture are you using (go env)?

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

package main

import (
	"fmt"
	"os"
)

func main() {
	f, err := os.Create("target")
	if err != nil {
		panic(err)
	}
	defer os.Remove("target")
	defer f.Close()

	err = os.Symlink("target", "link")
	if err != nil {
		panic(err)
	}
	defer os.Remove("link")

	st, err := os.Stat("link")
	if err != nil {
		panic(err)
	}

	fmt.Println(st.Name())
}

What did you expect to see?

"link"

What did you see instead?

"target"

@gopherbot
Copy link

@gopherbot gopherbot commented Apr 21, 2017

CL https://golang.org/cl/41310 mentions this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.