Skip to content

path/filepath: filepath.EvalSymlinks returns without error for non-symlink, valid paths #23503

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

Closed
PrototypeNM1 opened this issue Jan 22, 2018 · 2 comments

Comments

@PrototypeNM1
Copy link

PrototypeNM1 commented Jan 22, 2018

My initial assumptions on the nature of the bug were wrong, so the behavior described might be intended (though I did not find clear documentation that the behavior is expected).

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

go version go1.9.2 windows/amd64

Does this issue reproduce with the latest release?

Yes

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

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\username\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config

What did you do?

package main

import (
	"fmt"
	"path/filepath"
)

func main() {
	if path, err := filepath.EvalSymlinks("c:\\Go"); err == nil {
		fmt.Println("Not symlink but no error")
	}
}

What did you expect to see?

Nothing printed as no symlink was provided.

What did you see instead?

Any valid path returns without error.

@PrototypeNM1 PrototypeNM1 changed the title filepath.EvalSymlinks returns without error for non-symlink, drive letter only paths filepath.EvalSymlinks returns without error for non-symlinks Jan 22, 2018
@PrototypeNM1 PrototypeNM1 changed the title filepath.EvalSymlinks returns without error for non-symlinks filepath.EvalSymlinks returns without error for non-symlink, valid paths Jan 22, 2018
@mvdan
Copy link
Member

mvdan commented Jan 22, 2018

EvalSymlinks returns the path name after the evaluation of any symbolic links.

(emphasis mine)

I believe this is by design, and I think that the line above should be clear enough. The godoc can always be extended with clarifications if other people think it's unclear as it is now.

@PrototypeNM1
Copy link
Author

This was probably a blind spot in my reading of "evaluation" then; for what it's worth I would have read "resolution" in place of "evaluation" correctly. I'll go ahead and close the issue.

@mikioh mikioh changed the title filepath.EvalSymlinks returns without error for non-symlink, valid paths path/filepath: filepath.EvalSymlinks returns without error for non-symlink, valid paths Jan 26, 2018
@golang golang locked and limited conversation to collaborators Jan 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants